Question

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)?

Was it helpful?

Solution

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.

OTHER TIPS

Maybe you are needing GetWindowRect.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top