Monday, May 31, 2010
How to emulate the HTC HD Mini in Visual Studio
(Windows Mobile 6.1 & 6.5)
With the release of HTC's HD Mini, Windows Mobile developers now have another resolution to worry about. And its not unreasonable to assume that HTC will be able to move a large number of these devices with the popularity of the HD and HD2.
You can take a look at the specifications here:
What's important to note is the screen resolution of 320x480 - this is the only Windows Mobile device that I know of that uses this resolution. What's also important is the screen DPI - which is most likely 128. QVGA devices like the Touch are 96dpi and VGA and WVGA devices are 192dpi.
Its also worth noting that this device has a height to width ratio of 3 to 2 where normal devices are 4:3 and the wide devices are 5:3 so you may need to make some minor alternations to your GUI code when supporting the mini.
Now I haven't been able to find an emulator for this device but fortunately we can fake it using the Windows Mobile 6 SDK. I had a clever friend that works in Redmond help me out with this so I big thanks to her.
Fortunately we can use the Microsoft Device Emulator to launch a recompiled emulator image and change the display properties. Now remember I mentioned 128dpi? There is only one emulator image that supports this and that is the 320x320 Square QVGA emulator image. You can try other images but the resources will be incorrect and the sizes of menus, icons, etc will be either too big or too small.
So lets cut to the chase, assuming you have Visual Studio 2005 or 2008 installed and the Windows Mobile 6.1 SDK you can launch the emulator from the command line or by using a Batch file with the following command:
"C:\Program Files\Microsoft Device Emulator\1.0\DeviceEmulator.exe" "C:\Program Files\Windows Mobile 6 SDK\PocketPC\DeviceemulationV610\0409\PPC_USA_GSM_QVGA_VR.BIN" /memsize 256 /hostkey Left-Alt /video 320x480x16
or for 64 bit systems:
"C:\Program Files (x86)\Microsoft Device Emulator\1.0\DeviceEmulator.exe" "C:\Program Files (x86)\Windows Mobile 6 SDK\PocketPC\DeviceemulationV610\0409\PPC_USA_GSM_QVGA_VR.BIN" /memsize 256 /hostkey Left-Alt /video 320x480x16
(Launching the emulator at 320x480 - Windows Mobile 6.1)
You can also try the 6.5 image but I wasn't able to get the start menu working, presumably there are additional resources needed for the 480 high screen:
"C:\Program Files\Microsoft Device Emulator\1.0\DeviceEmulator.exe" "C:\Program Files\Windows Mobile 6 SDK\PocketPC\DeviceemulationV650\0409\PPC_USA_GSM_320x320_VR.BIN" /memsize 256 /hostkey Left-Alt /video 320x480x16
Once you have it up and running, you can cradle it just like any other emulator, it will show up in the Device Manager at the bottom with an ID string in the "Others" section.
(Custom emulator shown in the Device Manager)
(Debugging Calc Pro with the custom launched emulator)
Good luck and feel free to post questions