请问:谁能详细解释一下MapWindowPoints函数
rt
[解决办法]
最详细的:
Windows GDI
MapWindowPoints
The MapWindowPoints function converts (maps) a set of points from a coordinate space relative to one window to a coordinate space relative to another window.
int MapWindowPoints(
HWND hWndFrom, // handle to source window
HWND hWndTo, // handle to destination window
LPPOINT lpPoints, // array of points to map
UINT cPoints // number of points in array
);
Parameters
hWndFrom
[in] Handle to the window from which points are converted. If this parameter is NULL or HWND_DESKTOP, the points are presumed to be in screen coordinates.
hWndTo
[in] Handle to the window to which points are converted. If this parameter is NULL or HWND_DESKTOP, the points are converted to screen coordinates.
lpPoints
[in/out] Pointer to an array of POINT structures that contain the set of points to be converted. The points are in device units. This parameter can also point to a RECT structure, in which case the cPoints parameter should be set to 2.
cPoints
[in] Specifies the number of POINT structures in the array pointed to by the lpPoints parameter.
Return Values
If the function succeeds, the low-order word of the return value is the number of pixels added to the horizontal coordinate of each source point in order to compute the horizontal coordinate of each destination point; the high-order word is the number of pixels added to the vertical coordinate of each source point in order to compute the vertical coordinate of each destination point.
If the function fails, the return value is zero.
Windows NT/2000/XP: To get extended error information, call GetLastError.
Remarks
If hWndFrom or hWndTo (or both) are mirrored windows (that is, have WS_EX_LAYOUTRTL extended style), MapWindowPoints will automatically adjust mirrored coordinates if you pass two or less points in lpPoints. If you pass more than two points, the function will not fail but it will return erroneous positions. Thus, to guarantee the correct transformation of rectangle coordinates, you must call MapWindowPoints with two or less points at a time, as shown in the following example:
RECT rc[10];
for(int i =0; i < (sizeof(rc)/sizeof(rc[0])); i++)
{
MapWindowPoints(hWnd1, hWnd2, (LPPOINT)(&rc[i]), (sizeof(RECT)/sizeof(POINT)) );
}
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Coordinate Spaces and Transformations Overview, Coordinate Space and Transformation Functions, ClientToScreen, POINT, RECT, ScreenToClient
--------------------------------------------
© 2002 Microsoft Corporation. All rights reserved.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Coordinate Spaces and Transformations Overview, Coordinate Space and Transformation Functions, ClientToScreen, POINT, RECT, ScreenToClient
--------------------------------------------
© 2002 Microsoft Corporation. All rights reserved.