I've developed a application which uses Vista (or higher) API's and i would like to add a popup message if the application detects a unsupported OS.
I would like to add a popup message when a user runs my application on windows XP. Currently the application just throws a popup(messageBox) saying that some DLL's can't be loaded.
I've defined the windows version like this:
#define _WIN32_WINNT 0x0600
What do i have to do to prevent from running on versions lower than Vista? Do i have to check the OS version when the application starts (and show a message to the user)?
If you are using APIs that are not available on XP, you will need to separate your application into a loader and the real app (or a loader and a DLL containing the actual app). Compile the loader with #define _WIN32WINNT 0x0501
to ensure that it can run on XP and display your popup.
Check the version with VerifyVersionInfo or GetVersionEx
In order to show a popup message, you need to run the executable. That means that you have to reduce your windows version to the lowest one you intend to 'support' (support here meaning be able to run at, and show a popup saying that it won't run). That would require you to delay the point were you link to your relevant DLLs, otherwise they won't be found and you would still get the same message box you do know.
All in all, there are numerous drawbacks with this approach since you have to build a valid executable both at XP as well as Vista. If you really need this check, then you could have one executable do it and decide whether to show a popup message or start your actual application (in a different executable).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With