Windows系统下通过winapi获取当前显示器屏幕分辨率VC示例代码:
1 2 3 4 5 6 |
HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); MONITORINFO info; info.cbSize = sizeof(MONITORINFO); GetMonitorInfo(monitor, &info); int monitor_width = info.rcMonitor.right - info.rcMonitor.left; int monitor_height = info.rcMonitor.bottom - info.rcMonitor.top; |
文章评论