• Advertisement

Archived

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

Win32 get current window size function?

This topic is 5322 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

I want to know if there is a function that will return the current size of the current window. I have found reference of how to get the max and minimum sizes of the current window, but I can''t seem to find anything on google about how to get the current size of the current window. I want to do this in straight WIN32 API, no MFC, no DirectX, no OpenGL.

Share this post


Link to post
Share on other sites
Advertisement
RECT rc;
GetClientRect(hWnd,&rc);

or GetWindowRect(hWnd,&rc);



------------------------------------------------------------
// TODO: Insert clever comment here.

[edited by - drowner on June 25, 2003 4:30:58 PM]

Share this post


Link to post
Share on other sites
Not that there is a difference between GetClientRect and GetWindowRect. If you want the size of a window, you probably want GetClientRect (but I think you could compute it from either).

Share this post


Link to post
Share on other sites
quote:
Original post by Russell
Not that there is a difference between GetClientRect and GetWindowRect.
Actually, there is a difference between the two. GetWindowRect returns the dimensions of the entire window - frame, menus, etc - while GetClientRect returns the dimensions of the client or drawable area alone.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
GetWindowRect also returns screen coords, whereas GetClientRect always returns 0s for left and top and the width in right and the height in bottom. that''s because GetWindowRect''s coords are relative to the desktop origin and GetClientRect''s coords are relative to the given window''s client area.

Share this post


Link to post
Share on other sites

  • Advertisement