• Announcements

Archived

This topic is now archived and is closed to further replies.

Get Window Size

5 posts in this topic

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]
0

Share on other sites
Look up "GetWindowInfo"
0

Share on other sites
GetWindowRect is what you''re looking for.
0

Share on other sites
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
0

Share on other sites
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!
0

Share on other sites
Thanks for the replys, I''ll try some of those out.
0