If you want to be doubly sure though, in the defines section, or before you include windows.h, define the macro WINVER=0x0410 and _WIN32_WINDOWS=0x0410. This will make sure it will work on all versions of windows from windows 98 onwards. But as Ayman said, be careful with what API you are using because the available functions differ through windows versions.
Code built with VS2005 should work on all the versions of windows you mentioned unless you are using a specific Windows API (in your code) that exists in one version but not the other.
As for launching an executable through the IDE, just press F5.
One more note: Visual C++ 2005 selects the UNICODE variants of the windows APIs by default (eg. MessageBoxW, CreateWindowExW, CreateFileW). These UNICODE APIs aren't available in Win9x, so your app won't work with them.
If you want to make your VC2005 app work in Win9x, you should make use of the Microsoft Layer for Unicode (see the topic in MSDN).
Someone else is defining it It might already be defined already in stdafx.h (or the project properties), or it's being defined in windows.h. In the first case, look inside stdafx.h, In the second case, make sure you define WINVER before #including windows.
arooni wrote:
If I use api calls like createwindowex (not createwindoexexw),
I'm assuming this was a spelling mistake, and what you meant was this:
arooni wrote:
If I use API calls like CreateWindowExA (not CreateWindowExW),
As long as you get the spelling correct, then yes, they will be compatible. But now, in order to avoid those unicode variants, you must now properly spell out the API, including the A at the end (createwindowex is wrong spelling and won't compile. CreateWindowEx gives CreateWindowExW now. CreateWindowExA is correct spelling and will give you CreateWindowExA).
But if you link to unicows.dll (as described in the links), you get the best of both worlds. You can make use of unicode AND still work with Win9x.
1) #define WINVER 0x0410 // resulted in a warning that I redefined it...., however, I never defined it in any of my header files... why is this
2) If I use api calls like createwindowex (not createwindoexexw), will those be backward compatible to earlier versions of windows (like 98SE, ME, etc...) In other words, if I avoid those unicode variants, am I aOK without having to do anything else
Thanks!
How do you define windows version for compiling? & run from VS?
How do you define windows version for compiling? & run from VS?
Airex
Rahul_hk1
Code built with VS2005 should work on all the versions of windows you mentioned unless you are using a specific Windows API (in your code) that exists in one version but not the other.
As for launching an executable through the IDE, just press F5.
Thanks, Ayman Shoukry VC++ Teamelias_adum
One more note: Visual C++ 2005 selects the UNICODE variants of the windows APIs by default (eg. MessageBoxW, CreateWindowExW, CreateFileW). These UNICODE APIs aren't available in Win9x, so your app won't work with them.
If you want to make your VC2005 app work in Win9x, you should make use of the Microsoft Layer for Unicode (see the topic in MSDN).
dinsdale
I'm assuming this was a spelling mistake, and what you meant was this:
As long as you get the spelling correct, then yes, they will be compatible. But now, in order to avoid those unicode variants, you must now properly spell out the API, including the A at the end (createwindowex is wrong spelling and won't compile. CreateWindowEx gives CreateWindowExW now. CreateWindowExA is correct spelling and will give you CreateWindowExA).
But if you link to unicows.dll (as described in the links), you get the best of both worlds. You can make use of unicode AND still work with Win9x.
J. Ho
1) #define WINVER 0x0410 // resulted in a warning that I redefined it...., however, I never defined it in any of my header files... why is this
2) If I use api calls like createwindowex (not createwindoexexw), will those be backward compatible to earlier versions of windows (like 98SE, ME, etc...) In other words, if I avoid those unicode variants, am I aOK without having to do anything else
Thanks!