0

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

David Hall
  • 32,624
  • 10
  • 90
  • 127
sold
  • 2,041
  • 5
  • 25
  • 32

3 Answers3

2

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.

itowlson
  • 73,686
  • 17
  • 161
  • 157
2

Maybe you are needing GetWindowRect.

0

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.

Phillip Knauss
  • 668
  • 5
  • 7