July 31, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Creating Applications for the Pocket PC

  • August 22, 2003
  • By Karl Moore
  • Send Email »
  • More Articles »

As devices such as the Pocket PC become almost as powerful as the machines sitting on our desks, it makes sense that more and more developers will want to start creating applications directly targeted at such platforms.

In the old days, however, this was pretty difficult. You had eMbedded Visual Basic, which allowed you to create Windows CE applications, but programming inconsistencies and sticky development techniques didn't make for an easy ride.

But, with the release of Visual Studio .NET 2003 (Everett), Microsoft has introduced a new solution. It's a two-part fix that allows you to create applications to run on resource-constrained devices such as the Pocket PC and Windows CE handhelds, in almost the same way that you'd create a regular Windows application.

The first part to the solution is the .NET Compact Framework. This is a mini version of the .NET Framework, weighing in at almost 2MB (compared with 20MB+ for the full Windows version). The .NET Compact Framework runs on your device and includes a large selection of the core Framework classes, including a wide range of controls, plus even stretches to supporting Web services.

The second part to the solution is the ability to create a smart device application. This is like a tiny Windows application, with a typical Pocket PC form defaulting to 240 by 320 pixels. The program is built on top of the .NET Compact Framework (which can run on your development machine) and can be packaged into a CAB file and installed directly on your target device.

TOP TIP Are you using Visual Studio .NET 2002? Although the .NET Compact Framework betas allowed VS .NET 2002 users to create smart device applications, the final release ships only with Visual Studio .NET 2003 (Everett), which means that you either upgrade or ship out.

Building for the Compact Framework

How do you get started with developing for the .NET Compact Framework (CF)? Simply fire up Visual Studio .NET and create a new Smart Device Application. You'll be presented with a wizard, asking what sort of application you'd like to create.

You'll need to choose the platform you wish to target and the type of application you'd like to create. As the industry moves more toward Pocket PC devices, the norm here would be to select a Windows application running on the Pocket PC.

TOP TIP Looking for a niche software market? Hundreds of developers create component libraries for the COM and .NET development worlds. But how many create class libraries for Pocket PC developers? Perhaps libraries that overcome the limitations imposed by the "trimming" of the .NET Compact Framework?

After selecting your project type, you should be presented with your first form. From here, you can begin development just as with a regular Windows application, with a few obvious size restrictions.

The big thing to remember here is that the framework supporting this type of project is not the .NET Framework. It's the .NET Compact Framework. This means that, although you can still develop your program as you would a regular Windows application, not everything will operate exactly as you expect.

For instance, controls will look different and may vary slightly in the way they operate, and certain classes may be unavailable or work in an altered fashion. But it's generally similar: you can add extra forms and open them using standard techniques; you can create smart device class libraries and reference them as you'd expect; and you can add Web references and interact with Web services as usual.

On the whole, it's a relatively easy shift.



Click here for larger image

Figure: Visually designing my Pocket PC application in Visual Studio .NET

So, you've developed a neat Pocket PC project and want to give it a test run. But how? Simply follow the usual VS .NET debugging techniques: select Debug > Start to begin. You should be asked which device you wish to deploy your application on.

For example, creating a Windows application for the Pocket PC will allow you the option of using the Pocket PC 2002 emulator or a live debug session with a connected Pocket PC. Chose your target and select Deploy.

If the .NET CF hasn't yet been installed on your device, VS .NET will install it for you and then run your application. This is where you step in: test your application, step through your code, and identify bugs. This is just the same as with regular Windows applications.

TOP TIP The first time you run the Pocket PC 2002 emulator, you'll probably be asked to set up the device, "tapping" through the welcome screens. The emulator is actually a fully working version of the Pocket PC operating system and therefore reacts in the exact same manner. It's one of the best emulators I've seen.

Figure: A sample application running in the Pocket PC 2002 Emulator





Page 1 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel