What is _WIN32_WINNT and how does it work?

EDIT 2: Okay, so I switched to Orwell DevC ++, which contains "winnt.h", which contains #define KEY_WOW64_64KEY 0x0100, but it still does not work. (See EDIT 1 :)

EDIT 1: I looked at "winnt.h" that appeared along with CodeBlock and DevC ++, and DevC ++ skips the following lines:

#if (_WIN32_WINNT >= 0x0502) #define KEY_WOW64_64KEY 0x0100 #define KEY_WOW64_32KEY 0x0200 #endif 

And installing the above code in wint.h from DevC ++ does not work.


Original post: I have a 32-bit application (DevC ++ and Windows 7 development 64 bit) that reads the 64-bit application registry as one of its tasks, so I try to use the "KEY_WOW64_64KEY" flag in RegOpenKeyEx and did not find any messages about how to use it with _WIN32_WINNT: this and

It worked like a charm when I used it in the CodeBlock project (test project), but the same code doesnโ€™t work with DevC ++, I canโ€™t transfer it to the code block, because there are other problems in the code block.

How do I get to work with DevC ++?

thanks

+4
source share
2 answers

It determines the version of Windows header files to use. It should be declared before you #include <Windows.h> .

There are several other similar variables that you should probably set if you are going to change it:

MSDN Using Windows Headers

+10
source
  • _WIN32_WINNT is the preprocessor token that is replaced with (0x0601) wherever _WIN32_WINNT used. The preprocessor simply scans the entire file and replaces _WIN32_WINNT with (0x0601) wherever it is found.

Most likely, there may be ifdef preprocessor guards that will enable / disable the preprocessor constant. For instance:

 #ifdef _WIN32_WINNT #define KEY32 32 #endif 

There, KEY32 will be KEY32 only by IF _WIN32_WINNT .

  • It already works with DevC ++.
+2
source

All Articles