Windows Mobile 6 SDK gives Empty Toolbox in Visual Studio

May 24, 2007

I finally got around to installing the SDK for WM6. Turned out that my Toolbox (in Visual Studio) was completely empty when I started a new WM6 project afterwards.

The solution was to right-click the toolbox and select “Reset Toolbox” from the context menu. This was highly annoying because it of course removed my custom tools (e.g. the Ajax Toolkit). Anyway, at least it’s working.

Windows Mobile 6

February 13, 2007

As you probably know Windows Mobile 6 has been announced, along with a new SDK. The SDK doesn’t seem to be available yet, but according to the What’s New for Developers Guide, you can use the new emulator with WM 5.0 development.

WM6 is also fully backwards-compatible (it uses Compact Framework 2.0 SP1) so any WM5 app that doesn’t use a lot of esoteric code will run just fine as it is on WM6.

edit: Turns out they dropped the .0 from the version, so while it is Windows Mobile 5.0, the new version is just Windows Mobile 6…

Emulator 101

July 12, 2006

This is perhaps a newbie topic, but I have seen people use the emulator wrong (IMO), so today I’ll write about the basics regarding the emulator in Visual Studio 2005.

Unfortunately support for Windows Mobile 5.0 devices wasn’t ready when Visual Studio 2005 was released. There was a quite stable beta (Magneto) available, but several things was changed for the final release.

So lets assume you have a clean install of Visual Studio.
Download and install the Windows Mobile 5.0 SDK. Also download and install ActiveSync. If all goes well you should have a couple of new project types in Visual Studio, e.g. Visual C#->Smartdevice->Windows Mobile 5.0 Pocket PC. If you start a new project like this, you have access to the emulator for testing.

I think it’s important how you think about the emulator. I think it is common to simply think of it as a test run-time, i.e. you start it each time you test your application, then close it when you’re done. A better way is to think of it as a real physical device that just happens to be located on your machine. That means you start it and then keep it running in the background. If you press the stop button in Visual Studio (when debugging) the application will stop, but the emulator will keep on running. In this way at least you save some time not having to start the emulator each time.

How to use it:
You should start the emulator through the Device Emulator Manager. Go to Tools->Device Emulator Manager…
This manager is a powerful, but not very user-friendly tool (to start, you have to scroll to get to the Windows Mobile emulators). Start the emulator by right-clicking on Windows Mobile 5.0 Pocket PC Emulator and select Connect. If the emulator has a black screen, it means that is booting – just wait it out. If this is the first time starting the emulator, it may be a good idea to set up any changes (e.g. network connections see below) now, and the just close it again – answering Yes to save the emulator state.

If you do this and then start the emulator again (you might have to click the Refresh button on the DE Manager), you’ll see that it starts much quicker (with any changes you made). This is of course because of the saved state is just loaded in again exactly as it where.

One real neat thing about the emulator is that it is an exact copy of the real thing. So if you don’t have a real device you can play around with it to see how it’s like. If you mess it up, just don’t save the state when you close the emulator, and everything is back to normal (File->Clear Saved State (in emulator) if you accidentally save a messed up state).

If you start your program in Visual Studio (and select the Emulator in the dialog) it starts inside the emulator. An extremely cool thing is that you can set breakpoints and do remote debug against it (as you can do with a real device).

How to connect it to the Internet:
You have to use ActiveSync to do this. Make sure it is installed, then when the emulator is running – right click it in the Device Emulator Manager, and select Cradle. After a few seconds ActiveSync will pop-up after having noticed the new device. Just click cancel if ActiveSync wants to set up a profile for the device, and click Stop if it tries do synchronize. As you can see ActiveSync doesn’t know that it is an emulator, to it this is just another device connected to the PC via a cable.

You now have access to the emulators file-system either by clicking Explore in ActiveSync or selecting “Mobile Device” in Windows Explorer (under My Computer). Select My Windows Mobile-Based Device to go to the root of the device. The emulator should now be able to connect to the Internet through ActiveSync (make sure ActiveSync is not blocked by a firewall). Verify this by starting Internet Explorer in the emulator and click on the “Windows Mobile” logo (picture).

Tip: If you get the cannot connect error, go to Settings->Connections->Advanced. Then click Select network and select My work network in the topmost dropdown (so that both have this selected). Then click OK in top right corner twice. Back in IE try clicking on the logo now – usually that does the trick


July 11, 2006

Some cool news: .Net might be coming to the Symbian OS (Nokia, SonyEricsson etc.) !

Unfortunately it’s only the CF 1.0 (for Smartphones), however CF2.0 is sure to follow if it is a success!

(from Nino.Mobile)

Testing with localized versions of Windows Mobile

July 10, 2006

For testing purposes it is very useful to be able to run your program on different language versions of Windows Mobile. Luckily you don’t have to buy different physical devices, just change the OS image in the emulator.

To do this start by downloading the images (note: there are different images for smartphones). After downloading the MSI files simply install them as normal, and the new OS will appear in the Device List with the 3 letter abbreviation as a prefix.

Unfortunately it installs 8 different devices (items in the list) for each language, and if you plan to install a lot of different languages this can be annoying. Another way to change the OS is to simply use the image binary itself. The binary is located at <path where you installed the image>/Deviceemulation/0414/ the one you probably want is called PPC_xxx.bin (xxx = language code) (to get it – either extract it from the MSI or install, get the bin then uninstall the image).

Go to the options for the emulator and select the binary in the OS Image Name textbox. After restart (and clearing state!) you are set to go!

Setting the emulator’s available RAM

July 9, 2006

It is useful to be able to change the Device emulators available RAM, however if you select File->Configure… in the emulator you are not able to change the values!

The supposed reason for this is that Windows Mobile does not support changing/adding RAM on the fly (if you put more RAM into your physical device, you have to restart it to be able to use it).

To change it: In Visual Studio, select Tools->Options…, then select Device Tools->Devices (You can also click Device Options on the Device toolbar). Select Windows Mobile 5.0 Pocket PC Emulator in the list to the left, and click Properties. Then click Emulator Options.
If you check the “Specify RAM size” checkbox, you are able to change the RAM (remember to restart the emulator!).

There are also some other important options here, I’ll come back to them later.

A final gotcha – if you have saved the emulator state any changes to the RAM will not be applied. You have to clear the saved state (in the emulator: File->Clear Saved State) and reset the Emulator for it to update.

Wait cursor

July 5, 2006

Getting the nice colorful system-is-busy hourglass (or whatever it is) to appear is extremely simple:

Cursor.Current = Cursors.WaitCursor;

Note that the animation will stay put until you change it back to Default, so it is a good idea to put it in a finally clause to make sure it happens:

try {
 Cursor.Current = Cursors.WaitCursor;
 //Do something time consuming…
finally {
 Cursor.Current = Cursors.Default;

In this way, even if you get an exception the cursor will switch back (this is a good idea for standard Windows Forms programming also btw)

Edit: The Cursor property is not on the form, but on System.Windows.Forms, changed the reference