This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Although the Compact Framework contains a rich set of support classes, you can not accomplish everything in managed code that you can in native code. There are times when you will need to step outside the Compact Framework and call existing APIs or access some pre-existing library.

Features that are not Exposed to Managed APIs

The following functionality can only be programmatically accessed via native code.

Feature Scenario Description

GDI Graphics

Working with sprites.

In the .NET Compact Framework, the Graphics object is a wrapper around the GDI+ API, and it does not wrap the particular DrawImage overloads that handle composing an image with a real Alpha Channel (for Partial Transparency) onto an underlying image.

Menu Extensibility

Adding custom context menus.

It is currently not possible to add custom menus to the Pocket Outlook applications using managed code.


Collecting user input in the form of electronic ink.

There is no support for the Ink controls as part of the .NET Compact Framework; however the third-party library does include a wrapper.


Playing back sound files.

The .NET Compact Framework does not include media playback features in its current release. To replay sound, it is necessary to write a wrapper for the native PlaySound API.

Today/Home Screen

Creating a custom Today or Home screen component requires native code to create the necessary plug-in.

Although native code is required, it is possible to call into managed code to perform specific actions. Although technically possible, this is not the recommend way to create Today screen plug-ins. Nevertheless, the dedicated will find the following topic helpful: Creating a Pocket PC Today Screen Plug-in with the .NET Compact Framework .


Advanced features.

CEMAPI interfaces do not implement QueryInterface, which means you can not call native methods by using PInvoke. This will limit the development of advanced features such as custom transports.


Determining device location.

Although the .NET Compact Framework does not include specific support for GPS, sample code is provided as part of the SDK for using GPS data in your managed applications. For more information, see Using the GPS Intermediate Driver from Managed Code.

Limitations and Constraints

This section details some of the caveats associated with managed code development.

Database Applications

When developing a database application in native code, you have access to the onboard EDB database via the EDB APIs. For more information, see EDB Reference. When developing a database application in managed code though, you must use an alternate set of database APIs—the Microsoft SQL Server 2005 Compact Edition .

SQL Server 2005 Compact Edition is a lightweight version of SQL Server 2005 for use as a local database on PCs, Tablet PCs, and Windows Mobile and Windows Embedded CE devices. you can use the same database to develop occasionally-connected applications across all of the Microsoft client platforms. This compact database can be used for local storage as well as data sync with other editions of SQL Server 2005. This makes it easier for you to write applications that have versions for both tablet/laptop/desktop and mobile devices. SQL Server Compact Edition is included in ROM in Windows Mobile 6 devices. For more information, see Writing Applications that Access Databases.

See Also