Value to pass to WIN32 API Function MonitorFromWindow as DWORD

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?

enter image description here

For instance other API's list the value underneath the constant:

enter image description here

2

1 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 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like