Function Reference


_WinAPI_ScreenToClient

Converts screen coordinates of a specified point on the screen to client coordinates

#include <WinAPIConv.au3>
_WinAPI_ScreenToClient ( $hWnd, ByRef $tPoint )

Parameters

$hWnd Identifies the window that be used for the conversion
$tPoint $tagPOINT structure that contains the screen coordinates to be converted

Return Value

Success: True
Failure: False

Remarks

The function uses the window identified by the $hWnd parameter and the screen coordinates given in the
$tagPOINT 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.

Related

$tagPOINT, _WinAPI_ClientToScreen

See Also

Search ScreenToClient in MSDN Library.

Example

#include <MsgBoxConstants.au3>
#include <WinAPIConv.au3>

Example()

Func Example()
        Local $hWnd = GUICreate("Example", 200, 200)
        Local $tPoint = DllStructCreate("int X;int Y")
        DllStructSetData($tPoint, "X", 641)
        DllStructSetData($tPoint, "Y", 459)
        GUISetState(@SW_SHOW)
        Sleep(1000)
        _WinAPI_ScreenToClient($hWnd, $tPoint)
        MsgBox($MB_SYSTEMMODAL, "_WinAPI_ScreenToClient Example", "Screen Cordinates of 641,459 is x,y position of client: " & @CRLF & _
                        "X: " & DllStructGetData($tPoint, "X") & @CRLF & _
                        "Y: " & DllStructGetData($tPoint, "Y") & @CRLF)
EndFunc   ;==>Example