LPtoDP

2.x

  BOOL LPtoDP(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 LPtoDP function converts logical coordinates (points) into device coordinates.

Parameters

hdc

Identifies the device context.

lppt

Points to an array of POINT structures. The coordinates in each structure are mapped to the device coordinates of 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.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

The conversion depends on the current mapping mode and the settings of the origins and extents of the device's window and viewport.

The x- and y-coordinates of points are 2-byte signed integers in the range –32,768 through 32,767. In cases where the mapping mode would result in values larger than these limits, the system sets the values to –32,768 and 32,767, respectively.

Example

The following example sets the mapping mode to MM_LOENGLISH and then calls the LPtoDP function to convert the coordinates of a rectangle into device coordinates:

RECT rc;

SetMapMode(hdc, MM_LOENGLISH);
SetRect(&rc, 100, -100, 200, -200);
LPtoDP(hdc, (LPPOINT) &rc, 2);

See Also

DPtoLP