tags:

views:

60

answers:

3

I can get the coordinates of a windows entire area, and the coordinates of the client area using the GetClientRect and GetWindowRect Win32 calls. My problem is that the GetClientRect always returns 0,0 for the top left. How do I figure out what the actual client region is relative to the window rect?

+2  A: 

Use ClientToScreen to convert the client coordinates to screen coordinates. The window rect (GetWindowRect) is already in screen coordinates, and includes the non-client area (borders, caption, etc)

dthorpe
+3  A: 

You can use ClientToScreen to get the coordinates of the upper left (0,0) point in screen coordinates. The RECT returned by GetClientRect will be appropriate to get you the lower right corner (just add to the POINT set by ClientToScreen).

Reed Copsey
A: 

You can also use the MapWindowPoints function to convert an entire RECT to screen coordinates at once.

Ben Voigt