Reputation: 225
I am trying to use SetDisplayConfig in a c++ project in order to manage the dysplays. I use windows 7 as OS and Visual Studio 2008 as editor. I include the header Winuser.h as suggested but when I try to compile the error 'SetDisplayConfig': identifier not found occurs. Any idea about the reason?
Thanks, Giorgio
Upvotes: 0
Views: 1248
Reputation: 51414
The MSDN documentation for the Windows API usually names both the header file, that declares an identifier, as well as the header file you should include. SetDisplayConfig is no different in that respect:
Header Winuser.h (include Windows.h)
To use SetDisplayConfig
you need to include Windows.h.
Since this API is available in Windows 7 and later versions, you also have to set the _WIN32_WINNT
preprocessor symbol, prior to including Windows.h:
#define _WIN32_WINNT 0x0601
Alternatively, you can define the preprocessor symbol inside the IDE, to have it passed to the compiler on the command line. Doing it this way ensures, that the symbol is defined prior to any includes. Additional information is available at Using the Windows Headers.
Upvotes: 1