How to detect different windows operating systems


I need to develop an application which can run on both pocket pc and a desktop pc. When it runs on a desktop pc, I want it to automatically detect the os and thus enable OpenGL and all the related libraries. When it runs on a pocket pc (windows mobile 2003), it can detect the os and enable OpenGL ES and the related libraries. Do anyone know how I can do this?



The PC application won’t run on a Pocket PC and vice-versa because one is an x86 binary and the other an ARM binary, so you’re going to end up creating two separate executables. You could isolate all of the platform-specific code (eg. rendering calls) in a separate DLL that is explicitly loaded by your application depending on the platform. This would allow you to keep the majority of the source code of your application the same for both operating systems.

The API to use to determine what version of the operating system that is currently running is GetVersionEx (look at the returned OSVERSIONINFO::dwPlatformId). This API is available on Windows and WinCE.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.