I am trying to create a single executable file for a simple Win32 application that should work on both Windows XP and Windows Vista / 2008.
Due to some changes in the way Vista works, some additional calls to the Win32 API need to be made for the program to function correctly, as it was in XP.
I am currently detecting whether the application is running on a version of Windows newer than XP, and additional win32 functions are called as needed. This works fine for Vista and Server 2008, but it doesn’t work for Windows XP.
In Windows XP, when I start the program, I get an error: the entry point of the ShutdownBlockReasonCreate procedure cannot be located in the dynamic link library USER32.DLL. This happens before any of my codes starts executing, and none of the code paths should work with XP when using XP.
I would really like to have only one executable file that works on both XP and Vista. If possible, I do not want to have conditional compilation and have two executables.
What is the best way to solve this problem?
source share