On 9/3/2011 12:50, Jim Michaels wrote:
> I *DO* target for windows 7/8/vista/xp/98 etc for using my windows xp machine 
> all the time (I am a developer, I target for platforms I don't have, 
> especially since I don't have 10 machines with varying OS's lying about).  it 
> would be extremely useful for me to be able to access windows vista and 
> windows 7 system metrics compiling on a windows xp box, because my customers 
> have windows 8, 7, vista, xp, 2000, 98, etc.!  So I need to target for ALL 
> the platforms when I am making utilities like mine (especially sysinfo).  
> 
> 
> what's the worst that could happen if I pretend I have windows 7?  the 
> GetSystemMetrics() or whatever it was called will simply return a 0, right?  
> (and so it does) so the call is a failure and I simply don't print anything 
> for output.
> 
> 
>   I wrote a wrapper batch file that allows me to automatically generate and 
> compile in an XML manifest resource required by windows vista/7/8 for running 
> in the protected Program Files.  
> 
> and I found out my apps run just fine (with the exception of windows 9x/me, 
> but that's been fixed in latest revision of compiler).  so now I can make 
> windows 7 exe's with my xp box and they work great.  If you want the batch 
> file for mingw-w64, it's at http://JesusnJim.com/code/compilers/mingw.html 
> and it' called gw2.cmd
> 
> 
> I won't go into the subject any more unless you want to.
> 
> your winuser.h fix worked. many thanks.
> 
> 

Its all nice, but please remember that behavior will be undefined on
versions of Windows prior to the one you targeted.

To be clear, you aren't pretending, you're just telling the compiler to
allow access to functions that may not exist on XP (the mingw-w64 crt
supports a minimum of XP, anything earlier is iffy, made even more
complicated by the C init codes). By requiring this action to be
explicit, you are also telling the compiler that you are aware that you
*might* be using functions from future versions of Windows.

Whether it works or not isn't really up to the compiler. It depends on
how you coded your program. For example, if you used GetProcAddress to
load functions from future versions of Windows, you could handle things
gracefully if it doesn't exist in your current version. If you used
simple linking, you get the usual "Entry point blahblahblah not found in
kernel32.dll." type of messages, or a crash/hang.

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to