Windows OS for Windows Mobile is available in various versions, but for this article we will be using Windows Mobile 6. Windows Mobile 6 uses .NET Compact Framework v2 SP2, and has 3 different versions:
- Windows Mobile 6 Standard (phones without Touch Screen)
- Windows Mobile 6 Professional (with Phone functionality)
- Windows Mobile 6 Classic (without Phone functionality)
Windows Mobile 6.1 and Windows Mobile 6.5 are other 2 higher versions available with some additional features as compared to Windows Mobile 6. Windows Mobile 7 expected to be released in 2010 and is said to have major updates.
This article concentrates on development on Windows Mobile 6 Professional.
This article will introduce you to the development for Windows Mobile 6 Professional, using Visual C#. Windows Mobile 6 has .NET Compact Framework v2 SP2 preinstalled. .NET Compact Framework is a Compact Edition of .NET Framework, and does not have all the features of the complete .NET Framework.
Following are the software required for development:
- Microsoft Visual Studio 2008
- Windows Mobile 6 Professional SDK Refresh (SDK contains emulator, used for testing, debugging. To download click here)
- ActiveSync (Used for Data Synchronizing between development machine and Windows Mobile, To download click here)
Without making any exception, we will follow the golden rule of learning by writing “Hello World” application.
We will assume that you have installed all the prerequisite software mentioned above.
Launch Visual Studio 2008 and select Visual C# (if prompted). Create a new Project (File -> New) as shown below:
While creating a new Project, Visual Studio 2008 IDE provides an option to select an installed template, which will create Project with all the basic requirements/structure for development. For Windows Mobile, we will select option Smart Device and template Smart Device Project as shown below. You can also provide:
- Name: Name for Project. We will call it as MyFirstApp.
- Location: Location where this project will be created. Browse and set the desired location. We will use default location for now.
- Solution Name: Name for referring the Solution. Usually we keep it same as Project Name.
Since Windows Mobile 6 has .NET Compact Framework v2, it will select the .NET Framework 2.0 from the dropdown on the top right. Click OK.
Next step is to select the Target platform, .NET Compact Framework Version and Template. For our application we will select:
- Target platform: Windows Mobile 6 Professional SDK
- .NET Compact Framework Version: .NET Compact Framework Version 2.0.
- Template: Device Application
Project MyFirstApp is successfully created and IDE will open a Form as shown.
Let me introduce you to the various sections on screen.
- This is the main section called development section. All the coding and designing of the Form is done here.
- This section is called Toolbox and lists all the available components. If this section is not visible click View->Toolbox.
- This section is called Solution Explorer and shows all the forms, resources and properties. If this section is not visible click View->Solution Explorer.
- This section is Properties and displays all the properties for the component selected. If this section is not visible click View->Properties Window.
By default Form is named as Form1. Let us first change the Name of the form. To do so select the form and the properties related to form will be listed in properties window.
The entire properties list is in the form of Key Value pair. For changing Name of form, change value of property Name. For this example we will change it to HelloWorldForm. Now this form will be referred as HelloWorldForm throughout the application.
Changing form name doesn’t change form caption (title) it is still showing Form1. To change caption change the value of property name Text. For this example we will change the Text to Hello World.
Also the file representing this form in Solution Explorer will still be referred as Form1.cs, again you can either keep the name of the file as it is or can rename it. We will rename it to HelloWorld.cs.