Get Window Size

Started by
4 comments, last by dirkduck 20 years, 9 months ago
Hey everyone. I'm looking to find a way to get the current size/position and other attributes of a window (using Win32+MSVC++6). I know that you can set/get the text of a control with SendMessage(hwnd, WM_GET/SETTEXT...etc), but I've been looking through MSDN and can't find anything like a "WM_GETSIZE" or "WM_GETPOSITION". Is there something like this that im just missing, or is there a whole other way to get size/position information? Thanks. [edited by - dirkduck on July 21, 2003 10:40:37 PM]
http://www.labino.net
Advertisement
Look up "GetWindowInfo"
GetWindowRect is what you''re looking for.
BOOL GetWindowRect(    HWND hWnd,	  // handle of window    LPRECT lpRect // address of structure for window coordinates); 


Implementation:
RECT windowRect
GetWindowRect(hwnd, &windowRect);

//To access members
windowRect.left
windowRect.right
windowRect.top
windowRect.bottom
Hi,
Its late and i need sleep, so this may be completely wrong but try this

case WM_SIZE:    cxClient = LOWORD (lParam) ;    cyClient = HIWORD (lParam) ;    SetDlgItemInt(dialog, IDC_SIZE, cxClient, FALSE);return 0;


you need a dialgo box "dialog" with a text output label called IDC_SIZE but im sure you know that,

im tired - yawn ---- yawn

night!
Thanks for the replys, I''ll try some of those out.
http://www.labino.net

This topic is closed to new replies.

Advertisement