I am testing the Windows API and I am having a lot of problems. Most recent: I turned on Windows.h and temporarily Winuser.h, but MonitorFromWindow (and related fields such as MONITOR_DEFAULTTONEAREST) are missing. In particular,
...'MONITOR_DEFAULTTONEAREST' was not declared in this scope
and
...'MonitorFromWindow' was not declared in this scope.
Other methods are displayed just fine, like LoadImage and CreateWindow. Is there some kind of inclusion that I am missing? I don’t think this is the way I called the methods, or even the way I included the header files, but if you ask, I can still post my code. There are not many.
Edit: when I check what is defined in scope, the closest methods are ModifyWorldTransform (...) and MonikerCommonPrefixWith (...); nearby fields begin with MONITOR_INFO, with the exception of MONITOR_ENUMPROC. No MONITOR_DEFAULTTONEAREST / NULL / etc.
Edit 2:
#define UNICODE #define _WIN32_WINNT 0x0500 #include <iostream> #include <process.h> #include <windows.h> #include <winuser.h>
...
HMONITOR monitor = NULL; HWND CreateFullScreenWindow(HWND hwnd){ if(monitor==NULL){ monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); } return hwnd; }
source share