现在的位置: 首页 > 综合 > 正文

ScreenToClient Function

2012年08月15日 ⁄ 综合 ⁄ 共 1258字 ⁄ 字号 评论关闭
文章目录

Reference:

http://msdn.microsoft.com/en-us/library/dd162952%28v=VS.85%29.aspx

Applies to: desktop apps only

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

Syntax

BOOL ScreenToClient(
  __in  HWND hWnd,
  LPPOINT lpPoint
);

Parameters

hWnd [in]

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

lpPoint

A pointer to a
POINT
structure that specifies the screen coordinates to be converted.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

The function uses the window identified by the hWnd parameter and the screen coordinates given in the
POINT structure to compute client coordinates. It then replaces the screen coordinates with the client coordinates. The new coordinates are relative to the upper-left
corner of the specified window's client area.

The ScreenToClient function assumes the specified point is in screen coordinates.

All coordinates are in device units.

Do not use ScreenToClient when in a mirroring situation, that is, when changing from left-to-right layout to right-to-left layout. Instead, use
MapWindowPoints. For more information, see "Window Layout and Mirroring" in
Window Features.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

抱歉!评论已关闭.