INF: Translating Client Coordinates to Screen Coordinates

ID Number: Q11570

2.03 2.10 3.00 3.10

WINDOWS

Summary:

The GetClientRect function always returns the coordinates (0, 0) for

the origin of a window. This behavior is documented in the "Microsoft

Windows Software Development Kit (SDK) Programmer's Reference"

manual.

To determine the screen coordinates for the client area of a window,

call the ClientToScreen function to translate the client coordinates

returned by GetClientRect into screen coordinates. The following code

demonstrates how to use the two functions together:

RECT rMyRect;

GetClientRect(hwnd, (LPRECT)&rMyRect);

ClientToScreen(hwnd, (LPPOINT)&rMyRect.left);

ClientToScreen(hwnd, (LPPOINT)&rMyRect.right);

Additional reference words: Translate device 2.03 2.10 2.x 3.00 3.10

3.x