BOOL DPtoLP(hdc, lppt, cPoints) | |||||
HDC hdc; | /* handle of device context | */ | |||
POINT FAR* lppt; | /* address of array with points | */ | |||
int cPoints; | /* number of points in array | */ |
The DPtoLP function converts device coordinates (points) into logical coordinates.
hdc
Identifies the device context.
lppt
Points to an array of POINT structures. Each coordinate in each structure is mapped into the logical coordinate system for the current device context. The POINT structure has the following form:
typedef struct tagPOINT { /* pt */
int x;
int y;
} POINT;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
cPoints
Specifies the number of points in the array.
The return value is nonzero if the function is successful. Otherwise, it is zero.
The conversion depends on the current mapping mode and the settings of the origins and extents for the device's window and viewport.
The following example sets the mapping mode to MM_LOENGLISH, and then calls the DPtoLP function to convert the coordinates of a rectangle into logical coordinates:
RECT
rc; SetMapMode(hdc, MM_LOENGLISH); SetRect(&rc, 100, 100, 200, 200); DPtoLP(hdc, (LPPOINT) &rc, 2);