Important:
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.
4/14/2010

There are several approaches which can be taken when developing applications for Windows Mobile devices. In this topic, we'll look at the various options and provide links to sources of more information.

Visual C++

Visual C++ is known as a "native" development language, as it talks directly to the hardware for the Windows Mobile device, with no intervening layers (unlike Visual C#, for example). Programming using C++ can be challenging, as it is not a trivial language to learn. Any errors in a C++ program, for example, accessing memory that has been freed, or forgetting to free memory, can potentially crash the entire device.

The advantages of using Visual C++ are execution speed, application size and flexibility. Applications written in C++ run very quickly and consume minimal resources: fast-action games are good examples of programs that benefit from C++. Furthermore, the ability to access low-level system components means that using C++ is the only way to create a Today or Home screen plug-in.

A good way to learn Visual C++ is to investigate the free Visual Studio Visual C++ Express Edition , watch the video training and WebCasts, and read through the documentation. Although the Express Edition of Visual Studio does not allow you to develop applications for Windows Mobile, almost everything you will learn about application development can be applied directly to mobile devices.

Visual C++ applications can interact with the Windows Mobile device by calling the Win32 APIs (Application Program Interface functions). These APIs are functions that perform particular actions, such as playing a sound or drawing a button on the screen. There are thousands of these APIs (Windows Mobile supports a subset of the complete "desktop" Windows set of Win32 APIs), and they are documented in the section entitled Windows Mobile Features (Native). When browsing this section, pay particular attention to the fact that some APIs are available only in Windows Embedded CE - a platform that is related to, but separate from, Windows Mobile. A table in the top right of each topic will clarify which API is supported by which platform.

If you have experience developing for Windows using Visual C++, you will not find the transition to Windows Mobile particularly jarring. You should read the sections covering installing and using the tools, and then the topic Making use of Device-Specific Featureswhich will highlight the unique abilities of Windows Mobile devices.

To begin a Visual C++ application, start Visual Studio, and select File, New, Project and select Smart Device under the Visual C++ node.

If you are new to both programming and Windows Mobile, it may be a good idea to begin with Visual C#, and then transition to Visual C++.

Visual C# and Visual Basic

Visual C# and Visual Basic .NET are "managed" development languages. Not only are they relatively easy to learn, but they support the .NET Compact Framework - a library of classes that perform a lot of frequently used programming tasks, to greatly simplify application development.

The development tools for C# and Visual Basic .NET include a fully what-you-see-is-what-you-get user interface designer. You can drag and drop buttons and other controls directly onto your application's window (called a "form" in managed programming), and then double-click to access the underlying code. This approach makes creating an application's user interface extremely fast and easy.

Extra classes covering everything from data structures to intercepting text messages are available to you as part of the Compact Framework library. You can read more about the framework in the section entitled the .NET Compact Framework Reference . To make use of Windows Mobile specific features, a set of extra classes are provided. These provide access to the device's features, for example, the list of Contacts, or built-in camera. The documentation for these classes is in the section entitled Windows Mobile Features (Managed).

If you have experience developing applications for Windows using Visual C#, the transition should be relatively painless. The Compact Framework is a subset of the .NET Framework, so some functionality may require a slight reworking of your code.

Visual C# is a great way to learn programming. You can learn more about using Visual C# on MSDN: for example, here is a topic entitled the Visual C# Programming Guide . To learn more about Visual Basic, here is another topic on MSDN: Getting Started with Visual Basic .

For more information, see the topic Developing with Managed Code.

To begin a Visual C# or Visual Basic .NET application, start Visual Studio, and select File, New, Project and select Smart Device under the relevant language node.

Client-side JScript

The web browser included with Windows Mobile devices - Internet Explorer Mobile - supports JScript. JScript is a superset of the language most commonly known as JavaScript. JScript programs are plain text files that are executed by the web browser. They can be embedded in an HTML page, or stored in separate files.

A JScript application is executed inside the web browser, and uses the web browser's window for input and output. It is possible to make use of AJAX programming techniques to provide a degree of user interaction, and to communicate with a remote server. Due to the nature of JScript, applications cannot access local data other than through cookies, which will introduce some limitations.

No developer tools other than a text editor are required to create a JScript application. The program may be stored locally, or accessed from a Web Server. For more information, see the section Programming with Internet Explorer Mobile and AJAX.

ASP.NET

While JScript is a client-side solution to writing Internet-style applications, ASP.NET is a server-side solution. With ASP.NET, you can write applications in C# or Visual Basic .NET that reside on a Web Server, and perform complex processing, including creating user interface controls, and accessing databases. ASP.NET isolates the device characteristics from the application, making it straightforward to run one application on many difference device-types.

For an introduction to developing for mobile devices using ASP.NET, see Creating ASP.NET Mobile Web Pages .

See Also