如何取得桌面窗口矩形大小?mfc

2024-11-26 23:22:26
推荐回答(3个)
回答1:

GetWindowRect(hWnd, &rect);
hWnd是桌面窗口句柄,rect就是你要的矩形

用这几句获取桌面所有窗口句柄:
HWND hWnd = ::GetDesktopWindow();
hWnd = ::GetWindow(hWnd, GW_CHILD);
while(hWnd ){
hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
}

用 这几句得到鼠标所在窗口句柄:
GetCursorPos(&ptMouse);
hWnd = ::WindowFromPoint(ptMouse);
while(::GetParent(hWnd) != DeskHwnd && hWnd != DeskHwnd && ::GetParent(hWnd) !=NULL)
{
hWnd = ::GetParent(hWnd);
}

回答2:

ALT+PRINT SCREEN

回答3:

是不是屏幕分辨率?