Programming the Pocket PC using
Visual Studio.Net
By William LaMartin, Editor, Tampa PC Users Group
lamartin@tampabay.rr.com
In my other article, Wireless in Manhattan, I mentioned writing a program for my new Pocket PC that allowed me to send email whenever I could find a wireless connection. In this article I want to go into the differences between creating a program for the Pocket PC and other “Smart Devices” and creating a program for a regular computer.
First off, as you all know, most regular computers run on the Windows operating system. The Pocket PC’s operating system is a baby version of that called Windows CE. Visual Studio .Net allows you to create programs for both operating systems, with the exception that the tools you have for working in Win CE are considerably more restrictive than those available for working in Windows.
I have touched on Visual Studio .Net before, and you may recall that it is a programming environment with several different programming languages from which to choose when embarking on a programming project. There are Visual C++ .Net, Visual C# .Net, Visual J# .Net and my language of choice Visual Basic .Net.
To begin a Pocket PC project using VB .Net, you simply open Visual Studio .Net, and select options that allow you to create a new Visual Basic .Net Smart Device Application. The picture below is the left part of my workspace--the Intergraded Development Environment (IDE)--that Visual Studio created for me. What you see now is the result of my adding controls to the blank form on the right to create my Pocket PC Send Mail application. The controls are chosen from the toolbox on the left. The controls available for a Smart Device application are fewer than those available for a regular Windows application. And the individual controls used in a Smart Device application are quite often much less configurable than their counterpart in a Windows application.

For those familiar with Visual Basic, the code is not that much different. Here is a listing of the code that is run when the Send button is pressed:
Password As String = ""Dim
The “SendMailSvc” in the code above refers to the web service I wrote (as a Visual Studio ASP .Net Web Service application) that resides at my web site and handles the email request. It resides at a URL that has been added as a reference to the current project.
As you work on your program, you want to test it. The easiest way to do this is to have Visual Studio run it in the Pocket PC Emulator, which is a software program that “emulates” a real Pocket PC. A screen capture of it with my program loaded is below. My own Pocket PC does not look in the least like the skin of the one at the right. What you see is just a generic version of such a device.

To install such a program on someone’s Pocket PC, their device must first have the Microsoft .Net Compact Framework installed. It is not part of the operating system Windows CE. This is equivalent to the requirement that to run a program created in Visual Studio .Net on a Windows computer, the computer must have the Microsoft .Net Framework. The big difference is that the Framework for a Windows computer is around 24 MB, the Compact Framework for a Smart Device is around 1.5 MB. To install the Compact Framework on your device, you download a Windows executable from Microsoft (around 14 MB since it must take into consideration all the different processors that a Pocket PC may have) and run it on your computer while the Pocket PC is synced to the computer. Again, I stress that installing the Compact Framework on your device only adds about 1.5 MB of files--not 14 MB.
Once you have the Compact Framework installed (you only need to do it once), to install a program created in Visual Studio to the Pocket PC, all you have to do is copy one CAB file created by Visual Studio to the device and then click on the file. There is a different CAB file created for each of the different processors that a Pocket PC may have.
If the developer is ambitious, he or she can create an installation package that has all the CAB files included and, based on what it determines the target device has as a processor, uses the appropriate CAB file to do the installation.
If anyone has any ideas for programs for the Pocket PC, I am interested in hearing about them. I have created three that are useful to me and am interested in trying others. That the newer versions of the device allow you to connect to the Internet via wireless connections when they are available opens up all sorts of possibilities. u