MonitorFromRect

機能
指定の矩形を含むディスプレイモニターのハンドルを取得する
Declare Function MonitorFromRect Lib "user32.dll" _
(lprc As Rect, ByVal dwFlags As Long) As Long
Declare Function MonitorFromRect Lib "user32.dll" _
(lprc As Rect, ByVal dwFlags As Integer) As Integer

HMONITOR MonitorFromRect(
LPCRECT lprc,
DWORD dwFlags
);
引数
lprc

矩形を指定するRECT構造体
dwFlags
指定の矩形がディスプレイモニターと交差していないとき、戻り値を指定する定数の一つ
戻り値
正常終了のとき                      ディスプレイモニターのハンドル
エラーのとき                        dwFlagsで指定した値
dwFlagsの定数

MONITOR_DEFAULTTONULL = &H0         0を返す
MONITOR_DEFAULTTOPRIMARY = &H1      主モニターのハンドルを返す
MONITOR_DEFAULTTOEAREST = &H2       矩形に最も近いモニターのハンドルを返す