![]() |
Platforms, Frameworks & Libraries »
Mobile Development »
Howto
Beginner
License: The Microsoft Public License (Ms-PL)
Windows Mobile App Development Part 1: Creating your first applicationBy mstruys, dougturnCorrectly install VS2008 and Windows Mobile SDK to create your first mobility app. Part 1 of 7 from www.myrampup.com. |
C#, WinMobile, .NET, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Microsoft Visual Studio 2008 Professional Edition or better provides a development environment that allows you to build applications in either native code (C / C++) or managed code (C# / Visual Basic .NET) for Windows Mobile devices.
This article provides information to correctly install Visual Studio 2008 and additional Windows Mobile Software Development Kits in order for you to create your first Windows Mobile application, targeting a Windows Mobile 6 device. This article also introduces the Device Emulator which allows you to test your Windows Mobile applications without the need to have a physical Windows Mobile device available.
Let us assume you have a brand new development machine that you want to use to develop applications for Windows Mobile devices. The first thing you want to do is install Visual Studio 2008 and, depending on the speed of your Internet connection, you might also want to install all MSDN help files locally on your development system. If you don’t own Visual Studio 2008, you can download an evaluation version of Visual Studio 2008 Professional. Installing both Visual Studio 2008 and MSDN Library for Visual Studio 2008 is pretty straightforward. After a number of installation prerequisite files have been installed on your development machine, immediately after you install the DVD containing Visual Studio 2008 Professional Edition in the DVD drive, you will see a setup wizard. By just selecting the default options, you will install Visual Studio 2008 with Smart Device Development enabled.
After the installation of Visual Studio 2008 and the MSDN Library for Visual Studio 2008, there is one more thing you might want to do. If you take a look at the installation dialog for both Visual Studio 2008 and the MSDN Library, you can see a hyperlink to check for updates. It is my recommendation to do so, since this guarantees you to install the latest security updates, depending on the Operating System you are running on.
Next, you need to download and install Visual Studio 2008 Service Pack 1. First, a relatively small installer will be downloaded, which downloads all necessary Service Pack 1 features, depending on the way you installed Visual Studio 2008. Depending on your download speed, this might be a lengthy operation.
Visual Studio 2008 should now work properly on your development machine. To verify correct installation of Visual Studio 2008, it is now time to start it from the Windows Start menu. After Visual Studio 2008 has started, you can create a new Windows Mobile application by clicking File - New Project. In the New Project dialog that is displayed, you can now select to create a Smart Device project, either in C# or in Visual Basic .NET. Let’s assume you want to create a Windows Mobile 6 application written in C#. To do this, expand the C# node in the Project Types window and select Smart Device. Visual Studio 2008 will give your project a default name and a default storage location. Optionally, you can give your project a name, and you can specify a location where your project will be stored. This is all the information you need to provide in this dialog. To continue creating your application, you must now click the OK button in the New Project dialog. This action will open the Add New Smart Device Project dialog in which you can specify what type of project you want to create and what additional settings you want for your project.
Before you continue creating your first Windows Mobile application, expand the Target Platform combo box. If you just installed a clean copy of Visual Studio 2008, you will see that you can create projects for a limited number of devices and that there is no support to create Windows Mobile 6 projects. In order to create Windows Mobile 6 projects, you must first install one or both of the Windows Mobile 6 SDKs. An SDK or Software Development Kit adds documentation, sample code, header and library files, emulator images, and tools to Visual Studio that let you build applications for a particular target. You need to install these SDKs separately because they were released independent and at a later time than Visual Studio 2008. More SDKs and additional emulator images might be available at a later time. To easily find new SDKs, there is a hyperlink to the Windows Mobile Developer Center on the Add New Smart Device Project dialog, from which you can download and install additional SDKs and emulator images. To make sure that the SDKs install properly, you must make sure to close Visual Studio 2008.
Note: If you have the Windows Mobile 6 SDKs already installed, for instance, to target Windows Mobile 6 devices from inside Visual Studio 2005, you need to either reinstall or repair the SDKs after installing Visual Studio 2008. If you don’t do this, you cannot target Windows Mobile 6 devices from inside Visual Studio 2008.

If you have installed one or both of the Windows Mobile 6 SDKs, you are ready to create your first application for a Windows Mobile 6 device. In order to repeat the steps shown in this document, you at least will need to install the Windows Mobile 6 Professional SDK.
With all the tools being installed, you are now ready to create your first Windows Mobile 6 application. For this application, you will target the Windows Mobile 6 Professional SDK. However, you can build applications and solutions for a large number of Windows Mobile devices and for generic Windows CE devices. With both Windows Mobile 6 SDKs installed, you can develop solutions for the following devices using Visual Studio 2008:
With Visual Studio, you can target two different versions of the .NET Compact Framework, a subset of the full .NET Framework that is used to write managed applications for Smart Devices. The following versions of the .NET Compact Framework can be targeted with Visual Studio 2008:
If you need to develop applications for older devices, or if you need to target a previous version of the .NET Compact Framework, you must use Visual Studio 2005. This is beyond the scope of this article, but you can install Visual Studio 2005 and Visual Studio 2008 side by side.
If you have created your first Smart Device project successfully, you will see the Form Designer in Visual Studio 2008, displaying your empty form.

You can see several important areas inside Visual Studio 2008 in Figure 2. The large area on the left hand side of Visual Studio 2008 that shows a skin of a Windows Mobile device is the Form Designer. You can add user interface controls by dragging them from the Toolbox and dropping them on the desired location inside Form1. The upper window on the right hand side of Visual Studio 2008 is the Solution Explorer. It contains a tree view of all your projects and files inside projects that are part of the solution you are working on. Under Solution Explorer, you can see the Properties window, which allows you to set properties for currently selected user interface controls.
Note: If the Properties window is not visible in your copy of Visual Studio 2008, you can make it visible by selecting View and then Properties Window on the Visual Studio 2008 menu.
Another important part inside your working area of Visual Studio 2008 is the Target Device dropdown box, which is marked by a red oval in Figure 2. Here, you can select to which device or which particular device emulator your application will be deployed once you are done developing it.
Button from the Toolbox and drop it anywhere on Form1.button1 to btnClickMe.Text property from button1 to Click ME!.Label from the Toolbox and drop it anywhere on Form1.Label inside Form1 so it occupies the entire width of Form1.label1 to lblInfo.Text property.Form1 visible in the Properties window by clicking anywhere on Form1.MinimizeBox property to False to allow you to terminate the application by clicking the OK button that will now be displayed in the upper right corner of Form1.Button to add a Click event handler to the button.lblInfo.Text = "Button '" +
btnClickMe.Text +
"' clicked at " +
DateTime.Now.ToLongTimeString();
Note: You will see syntax coloring inside the code editor, and Intellisense will assist you in entering this statement.
After some time, you will see the Windows Mobile 6 Classic Emulator starting. If necessary, .NET Compact Framework 3.5 will be deployed first to the emulator. Finally, your application will be deployed to the device, where it is automatically started.

Use Device Emulator and Cellular Emulator to test your applications.
Learn the basics of developing Windows Forms based applications for Windows Mobile devices.
Learn to add custom controls and make use of GPS hardware in your applications.
Learn to access data through DataSets and SQLCeResultSets in your Mobile apps.
Gain an understanding of device security, testing, and installation of your application on a Windows Mobile device.
Learn to create web based apps for Mobile devices with AJAX support enabled using browser controls.
Please visit www.myrampup.com for more information.
| You must Sign In to use this message board. | |||||||||||||||||||||||
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 30 Oct 2009 Editor: Smitha Vijayan |
Copyright 2009 by mstruys, dougturn Everything else Copyright © CodeProject, 1999-2010 Web21 | Advertise on the Code Project |