Reputation: 83
I'm using Qt with mingw to write a program that changes the registry, but when I call :
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DefaultProductKey",
0,
KEY_ALL_ACCESS|KEY_WOW64_64KEY,
&key);
Qt return :
`KEY_WOW64_64KEY' undeclared (first use in this function)
I had add "#include <windows.h>"
but it still doesn't work.
I've find this post Error with RegOpenKeyEx, it's the same probleme than me, and the answer looks good. But i'm not using windows xp i'm using 7(64bits). So I trided to put in targetver.h :
#ifndef _WIN32_WINNT_WIN7
#define _WIN32_WINNT_WIN7 (0x0601)
#endif /* _WIN32_WINNT_WIN7 */
And it's still doesn't work ... :(
What can i do ? :(
Thanks :)
(sorry for my bad english)
Upvotes: 4
Views: 2358
Reputation: 15154
You have to define the _WIN32_WINNT
(not _WIN32_WINNT_WIN7) before including the windows.h
header:
#ifndef _WIN32_WINNT
#define _WIN32_WINNT (0x0601)
#endif /* _WIN32_WINNT */
#include <windows.h>
Upvotes: 4