sold
sold

Reputation: 2091

How to get the full client rect?

The GetClientRect function, according to MSDN, is actually only good for determining the client width & height, since left & top are always zero. Is there a way to get the complete client coordinates, including left & top (either in screen space, or in window space)?

Upvotes: 0

Views: 975

Answers (3)

Don Griffes
Don Griffes

Reputation: 31

Maybe you are needing GetWindowRect.

Upvotes: 2

Phillip Knauss
Phillip Knauss

Reputation: 678

You're looking for the GetWindowPlacement function. This function returns a WINDOWPLACEMENT struct which has an rcNormalPosition property which specifies the window's position when it is in the normal (rather than maximized or minimized) display state.

EDIT: itowilson's answer is actually cleaner because the WINDOWPLACEMENT structure also contains a bunch of data you don't need.

Upvotes: 0

itowlson
itowlson

Reputation: 74802

Call ClientToScreen on the top left and bottom right of the returned RECT. If you're using MFC, CWnd has a helper overload of CWnd::ClientToScreen that will do this transparently for you.

Upvotes: 2

Related Questions