Jump to content

WinMapDlgPoints

From EDM2
Revision as of 17:25, 9 April 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function maps points from dialog coordinates to window coordinates, or from window coordinates to dialog coordinates.

Syntax

 WinMapDlgPoints(hwndDlg, prgwptl, cwpt, fCalcWindowCoords)

Parameters

hwndDlg (HWND) - Input
Dialog-window handle.
prgwptl (PPOINTL) - In/Out
Coordinate points to be mapped.
The mapped points are substituted.
cwpt (ULONG) - Input
Number of coordinate points.
fCalcWindowCoords (BOOL) - Input
Calculation control.
TRUE
The points are in dialog coordinates and are to be mapped into window coordinates relative to the window specified by the hwndDlg parameter.
FALSE
The points are in window coordinates relative to the window specified by the hwndDlg parameter and are to be mapped into dialog coordinates.

Returns

rc (BOOL) - returns
Coordinates-mapped indicator.
TRUE
Coordinates successfully mapped
FALSE
Coordinates not successfully mapped.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) An invalid window handle was specified.

Example Code

#define INCL_WINDIALOGS /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND          hwndDlg;            /*  Dialog-window handle. */
PPOINTL       prgwptl;            /*  Coordinate points to be mapped. */
ULONG         cwpt;               /*  Number of coordinate points. */
BOOL          fCalcWindowCoords;  /*  Calculation control. */
BOOL          rc;                 /*  Coordinates-mapped indicator. */

rc = WinMapDlgPoints(hwndDlg, prgwptl, cwpt,
       fCalcWindowCoords);

This example calls WinMapDlgPoints to map a point from dialog coordinates to window coordinates relative to the dialog window.

#define INCL_WINDIALOGS         /* Window Dialog Mgr Functions  */
#include <os2.h>

HWND  hwndDlg;          /* handle of dialog window              */
BOOL  fSuccess;         /* success indicator                    */
POINTL aptlPoint = {10, 20};       /* point to be mapped (dialog coords) */
POINTL aptlMappedPoint;

/* map point to relative window coordinates */
fSuccess = WinMapDlgPoints(hwndDlg, &aptlPoint, 1, TRUE);
aptlMappedPoint = aptlPoint; /* aptlPoint now contains window coordinates */

Related Functions