I’m looking to have vista/win7 use Aero-style windows while XP users use normal window style (how does one get windows XP stlye and not win95 styles btw?)
The idea is something like this:
OSVERSIONINFOEX osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((OSVERSIONINFO*)&osvi);
if (osvi.dwMajorVersion > 5) {
#pragma comment(linker,"/manifestdependency:\"type='win32' "\
"name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' "\
"processorArchitecture='x86' "\
"publicKeyToken='6595b64144ccf1df' "\
"language='*' "\
"\"")
}
Now, the #pragma gets executed no matter if the if-statement is true or false, which I guess is just the way #pragma works. Surely there is some other way to get this to working (something like #ifndef #define … #endif I guess)
Cheers
You are mixing compile-time evaluation of pragma with run-time execution of code. Obviously this won’t work.
It’s possible to keep a manifest for the application in “PutYourProgramNameHere.exe.manifest” file. So if you need different manifests for XP and Vista/Win7, then you can install different manifest files when you install the application on the target computer. I.e. your installer checks OS version and installs matching manifest.