• Advertisement

Archived

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

Get Window Size

This topic is 5294 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

  • Advertisement