ClientToScreen function (winuser.h)

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

Syntax

BOOL ClientToScreen(
  [in]      HWND    hWnd,
  [in, out] LPPOINT lpPoint
);

Parameters

[in] hWnd

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

[in, out] 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

Requirement Value
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
API set ext-ms-win-ntuser-window-l1-1-2 (introduced in Windows 10, version 10.0.10240)

See also

Coordinate Space and Transformation Functions

Coordinate Spaces and Transformations Overview

MapWindowPoints

POINT

ScreenToClient