The function calling the API in vba:
Private Declare PtrSafe Function MonitorFromWindow Lib "user32" (ByVal HWND As Long, ByVal DWORD As Long) As HMONITOR I have tried to pass 0 as dword,
Debug.Print MonitorFromWindow(Application.HWND, 0) hoping to get MONITOR_DEFAULTTONEAREST but the function returns nothing. What are the values of the below constants?
For instance other API's list the value underneath the constant:
21 Answer
These constants are defined in the SDK include file "WinUser.h" as
#define MONITOR_DEFAULTTONULL 0x00000000 #define MONITOR_DEFAULTTOPRIMARY 0x00000001 #define MONITOR_DEFAULTTONEAREST 0x00000002 