ClientToScreen function

The ClientToScreen function converts the client-area coordinates of a specified point to screen coordinates.

Syntax

BOOL ClientToScreen(
  HWND    hWnd,
  LPPOINT lpPoint
);

Parameters

hWnd

A handle to the window whose client area is used for the conversion.

lpPoint

A pointer to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

The ClientToScreen function replaces the client-area coordinates in the POINT structure with the screen coordinates. The screen coordinates are relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.

All coordinates are device coordinates.

Examples

For an example, see "Drawing Lines with the Mouse" in Using Mouse Input.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

Coordinate Space and Transformation Functions

Coordinate Spaces and Transformations Overview

MapWindowPoints

POINT

ScreenToClient