简体   繁体   中英

How do I find the position of my Dialog Window on the desktop?

I am looking for "Dialog window" coordinates relative to the "desktop window" as apposed to itself?

Neither of the following do what I need. The just start at 0,0

Defines dimension of Dialog window starting at 0,0

HWND hWnd = ::GetForegroundWindow();
::GetClientRect(hWnd, &rectWin);
c.Format("%d  %d  %d  %d", rectWin.top, rectWin.bottom, rectWin.left, rectWin.right);
MessageBox(c);

Defines dimension of the Desktop window starting at 0,0

HWND hWnd = ::GetDesktopWindow();
::GetClientRect(hWnd, &rectWin);
c.Format("%d  %d  %d  %d", rectWin.top, rectWin.bottom, rectWin.left, rectWin.right);
MessageBox(c);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM