Thanks to the wonder of Google, I was easily able to find this nearly 6 year old blog post that precisely addressed my question related to this ancient platform, namely how can I determine if I am running on the Device Emulator or physical hardware.
The reason one might need to know this is when you have OEM hardware built-in to your device, like in my case an integrated barcode scanner, which I don’t want to create when its running on the emulator. I could probably configure the emulator to have the OEM assemblies in place, but right now that’s more work than I have time for on this project.
As far as I can tell, there is no means in CF 3.5 to detect the emulator directly, only the platform, e.g. PocketPC, Smartphone or WinCEGeneric, via the WinCEPlatform property. I didn’t bother to probe further, but the PInvokes described in the post positively identify the Emulator, so that’s good enough for me.
Thanks to Christopher Fairbairn for his well-written post and sample code.
Filed under: General Tagged: Detection, Emulator, PInvoke, Windows Mobile
