Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Archives
Today
Total
관리 메뉴

Code Habit

[WinAPI] GetMonitorInfo - 모니터 Display 정보 구하기 본문

카테고리 없음

[WinAPI] GetMonitorInfo - 모니터 Display 정보 구하기

코드베어 2022. 10. 8. 11:20

GetMonitorInfo를 사용하여 모니터 Display 정보를 구할 수 있다. 

 

BOOL GetMonitorInfoA(
  [in]  HMONITOR      hMonitor,
  [out] LPMONITORINFO lpmi
);

hMonitor에 구하고자 하는 모니터 핸들을 넘기면 해당 모니터의 Display 정보를 MONITORINFO(structure)로 전달 받는다.

이때 MONITORINFO의 멤버변수 중 cbSize를 sizeof(MONITORINFO) (or sizeof(MONITORINFOEX)로 초기화하고 전달해야 한다.

 

typedef struct tagMONITORINFO {
  DWORD cbSize;
  RECT  rcMonitor;
  RECT  rcWork;
  DWORD dwFlags;
} MONITORINFO, *LPMONITORINFO;

rcMonitor로 모니터 Display정보를 전달받고 rcWork로 작업영역 정보를 전달 받는다.