#1617 Wrong Windows version check for AttachConsole


In the header wincon.h, the following line is preventing the use of AttachConsole on Windows 7 for no reason:

#if (_WIN32_WINNT >= 0x0501)

gcc version 3.4.5 (mingw-vista special r3)

The whole block:

#if (_WIN32_WINNT >= 0x0501)


  • Keith Marshall

    Keith Marshall - 2012-01-15
    • status: open --> closed-invalid
  • Keith Marshall

    Keith Marshall - 2012-01-15

    This is YOUR error, NOT a w32api bug. Furthermore, this is the second bogus bug report I have closed in as many weeks, relating to a user -- you in this case -- failing to define WINVER correctly.

    The correct definition of WINVER has NOTHING WHATSOEVER to do with the version of windows you might be running the compiler on -- I'm guessing Windows-7 in your case. I'ts purpose is to allow YOU to specify a MINIMUM version on which you want your application to run. If you don't specify otherwise, the current w32api version assumes you may want to support users on Win9x, so the guard is correct -- you can't use AttachConsole() and support 9x, so the compiler is correctly telling you this. It is YOUR choice to make, if you want to restrict your application to WinXP and later, (which is required for AttachConsole() -- and it is YOUR responsibility to define WINVER accordingly.

    FWIW, v3.18 of w32api will change the DEFAULT level of support to assume Win2K; you will STILL need to define WINVER to WinXP for AttachConsole(); you will ALSO need to set it back to 0x0400, if you want to guarantee Win9x support.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks