Share via


Creating your first Windows Phone (WM 6.5) application

With the release of Windows Mobile 6.5 drawing closer and closer, I inevitably started thinking about cool app ideas for the new Windows Marketplace for Mobile. As I've done some Mobile development in the past, I figured it would be quite straightforward to start developing 6.5 apps. I found the process to be a bit confusing, however, as there's no real new SDK (Software Development Kit), but instead Microsoft released a Developer Toolkit (DTK) in June for Windows Mobile 6.5 development. To clear up the confusion and to get you started with developing Windows Phone applications, I decided to write up a little guide to get you all set up and ready to go.

The first thing that you should get (or actually should already have) is Visual Studio. You can find several trial versions on the Visual Studio website, including handy VPC (VirtualPC) images if you wish to try it out without modifying your installation. Seeing as how we're quite close to the release of Visual Studio 2010, I intended on providing the steps for Visual Studio 2010 Beta 1 alongside Visual Studio 2008 SP1, but it seems that the Windows Mobile 6 SDK setup doesn't detect Visual Studio 2010 or .NET Framework 4.0. So, I'll be using a fresh install of the RTM version of Windows 7 with Visual Studio 2008 SP1 for all my screenshots and my code snippets and examples will be in C# .NET.

The first thing you should do, after installing Visual Studio, is download and install the Windows Mobile 6 Standard or Professional SDK here. This includes everything you need to get started with Windows Mobile 6 development. Be sure to check out the bottom of the download page for Windows Mobile 6.1 or 6.1.4 emulator images, if you're also interested in development for those platforms. Due to the scope of the guide, I'll only be installing the Windows Mobile 6 Standard and Professional SDKs. On the Prerequisites step of the installation wizard, you might get a notification that Windows Mobile Device Center is not installed. If you wish to deploy your applications on actual Windows Mobile devices, you will need WMDC, which can be downloaded for free from the Windows Mobile website. Since this is only needed for deployment to Windows Mobile devices, WMDC can also be installed when actually needed without having to reinstall the SDK. Aside from that, the wizard is pretty straightforward and shouldn't require any additional explanation from me.


Click on the image to view large version

To check if everything installed correctly, fire up Visual Studio and create a new project. At the project type selection screen, select Smart Device and choose the Smart Device Project template. After you enter a name for the project and click OK, a new window pops up for the platform selection. If the Target platform dropdown list holds entries for Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK (depending on which SDKs you installed), then the SDK has been installed properly. You should also see a new folder in the Start menu programs, called Windows Mobile 6 SDK, which contains documentation, samples and some tools. If you do not see a Standalone Emulator Images folder under the Windows Mobile 6 SDK folder (this seems to happen sometimes, but I have no idea what causes it), you can manually create a shortcut the the Device Emulator Manager, which is located at %ProgramFiles%\Microsoft Device Emulator\1.0\dvcemumanager.exe or %ProgramFiles(x86)%\Microsoft Device Emulator\1.0\dvcemumanager.exe on 32-bit or 64-bit systems respectively.

  
Click on an image to view large version

Now that we've verified that everything installed properly, it's time to start with the installation of the Windows Mobile 6.5 DTK. The DTK contains emulators, gesture APIs, and samples for Windows Mobile 6.5. You can download the DTK in a plethora of languages over at the Microsoft Download Center. The DTK installation wizard is very similar to the Windows Mobile 6 SDK installation wizard, so the process should feel familiar to you by now.


Click on the image to view large version

To verify the installation, open up the Start menu and under the Windows Mobile 6 SDK folder you should now have a Standalone Emulator Images folder (if you hadn't previously) with the Windows Mobile 6.5 emulator images.


Click on the image to view large version

Now that we're finally done installing the components to create our Windows Phone app, launch Visual Studio and create a new Smart Device Project. One of the things you will probably notice in the subsequent screen is that there are no new platforms selectable in the Target platform dropdown list. Don't worry, this is expected as we learned before that there's no actual new SDK included in the Windows Mobile 6.5 DTK. We didn't install the DTK without a cause, however, as it provides us with the emulator images and gesture APIs. So, select the Windows Mobile 6 Professional SDK or Windows Mobile 6 Standard SDK target platform, select Device Application as the template and hit OK to create the project.


Click on the image to view large version

Once the project is created, you will be presented with a new Windows Mobile 6 form, where you can drag & drop components from the Toolbox, like a Windows Forms .NET application. For now, just drop a Label control on the form and change the name to myLabel. Since we're writing a managed application, events are also at our disposal. So click on the title bar of the form and go to the events to create a new Load EventHandler. Once in the code view, add the following line of code inside the Load EventHandler:

myLabel.Text = "Hello Windows Phone!";

 

Click on am image to view large version

Having our code in place, hit F5 to start our app and see the output. A Deploy window will pop up after the application is built, asking us where we want to deploy our application. Select the Windows Mobile 6.5 emulator image of your choice and hit Deploy. A Windows Mobile 6.5 emulator will open and the Windows Phone will start its boot process. Once the process has completed, Visual Studio will start deploying a CAB file to the emulator image, which holds our application. After deployment, the application will be executed automatically and we will be presented with our brand new Windows Phone app.

  
Click on an image to view large version

Now that we've successfully deployed our Windows Phone app, it's time to start looking at the new additions to the API that the DTK has brought us. Unfortunately, the new gesture APIs are only included as unmanaged libraries, so we can't use them in our managed app by default. Luckily, Maarten Struys over at DotNETForDevices.com has created a managed wrapper for the new gesture APIs, so they can be utilized by managed developers. With these libraries, you should be all set to start using the new gesture APIs in your managed apps.

That wraps up the guide and hopefully you now have enough information to get started on your awesome Windows Phone app. If you have additional questions, drop me a comment, otherwise I look forward to seeing your app on the Windows Marketplace for Mobile!

Resources:
Windows Mobile for Developers website - https://developer.windowsmobile.com/
Windows Mobile Developer Center - https://go.microsoft.com/?linkid=9670344
Windows Mobile Team blog - https://windowsteamblog.com/blogs/windowsphone/default.aspx
Windows Mobile 6 Software Development Kits Refresh - https://go.microsoft.com/?linkid=9670862
Windows Mobile 6.5 Developer Tool Kit - https://go.microsoft.com/?linkid=9670343
Visual Studio website - https://go.microsoft.com/?linkid=9670864