Get started architecting Windows CE applications using .NET

Will the .NET Compact Framework fuel an explosion of CE applications much as Visual Basic did with Windows? Find out why Tim Landgrave thinks so and what you need to start developing a CE app.

Developing applications for Windows CE devices has always been a black art. Although Microsoft released two developer toolkits for use with Visual Studio 6.0, neither of them ever became widely used: The embedded Visual C++ (eVC) and embedded Visual Basic (eVB) toolkits were used mainly by companies writing system utilities or vertical applications, respectively.

In fact, a significant number of companies who wrote their first vertical CE applications using the eVB toolkit ended up rewriting those applications using the eVC kit. The big problem with eVB was related to the requirement of a Windows CE runtime on the device, which caused performance and memory utilization issues, as well as problems with distribution. The bottom line is this: Most applications written and deployed in the Windows CE environment have been developed in C/C++.

When considered in this light, the state of Windows CE development today is not that different from where the Windows 3.x world was before the introduction of Visual Basic 1.0—a few programmers working in an unwieldy environment and writing applications that are “bare to the metal” because of a lack of tools and libraries. Based on my work over the last year with the .NET based Windows CE development environment, I think we’re likely to see an explosion of Windows CE development similar to that created for Windows by the introduction of VB.

Windows CE application types
You can develop two different types of Windows CE applications using Visual Studio .NET. The Microsoft Mobile Information Toolkit (MMIT) allows you to create thin client applications that can morph to deliver information based on the device from which they’re accessed. This allows you to create a single application that can be consumed not only by Windows CE devices using the built-in browser, but also mobile phones using WAP. Of course, this requires you to program to the least common denominator (WAP) and requires an expensive full-time connection to consume the application.

The alternative is to write an application that resides on and executes from the Windows CE device itself. This is accomplished by installing a slimmed down (2 MB) version of the full .NET Framework on the device, which is called the Compact Framework (CF). You can use either of these tools (MMIT or CF) with Visual Studio .NET 2002 by downloading and installing the SDKs for them. The next release of Visual Studio .NET (2003) will include both products integrated into the development environment.

So what’s missing?
To shrink the 20-MB .NET Framework and make it fit on a device with limited RAM (currently between 32 MB and 64 MB), Microsoft had to make some important decisions regarding the role of the device in an application ecosystem. For example, since most Windows CE devices would not have full-time Internet connectivity and don’t include a native Web server, it didn’t make much sense to include the ability to host ASP.NET applications or Web services. This doesn’t limit their ability to consume Web services, only to host them.

Also, given the limited real estate and simpler interfaces used in Windows CE applications, it wasn’t necessary to support all of the Windows Controls available for standard Windows applications. For example, there are no Crystal reporting controls available for Windows forms in the Windows CE environment. Of course, the standard controls like text boxes, labels, list controls, and a grid control are included. Having a grid control is an improvement considering that the eVC and eVB toolkits didn’t include a grid control, forcing developers to create their own controls.

Local data access
Although there will certainly be general applications developed for Windows CE devices that don’t store any data locally, most corporate applications will need a local data store. This is where the argument for using Windows CE and the CF becomes really compelling over other alternatives.

Microsoft recently released version 2.0 of SQL Server for CE. This release consumes an additional 2 MB of memory on the device, but gives the developer a high performance and familiar data access environment to use for developing mobile applications. There are limitations to the size of a database and the number of indexes allowed, but in most cases you’ll come up against the memory limitation of the device before you’ll bump into SQL’s resource issues.

Of course, you can use the existing eVB and eVC toolkits with SQL Server for CE without using the CF, so what makes CF so special? It’s the integration of ADO.NET and SQL Server/CE. Once developers are familiar with developing database applications in VB.NET or C# using the full version of the .NET Framework, they can use those same skills to develop applications for Windows CE. And since SQL Server/CE includes a replication client, you can easily develop applications that connect through a standard HTTP connection to update automatically with an internal SQL Server 2000, configured as a replication distributor.

Get started
All you need to get started developing Windows CE applications is a copy of Visual Studio .NET 2002 with the Smart Device Extensions (which includes the CF) installed. If you’re an MSDN subscriber, you can download the final beta of Visual Studio .NET 2003, which integrates all of the tools necessary to start building CF-based applications. In either case, you’ll get a familiar, robust environment with end-to-end debugging for developing Windows CE applications.


Editor's Picks