Export (0) Print
Expand All

MapDialogRect function

Converts the specified dialog box units to screen units (pixels). The function replaces the coordinates in the specified RECT structure with the converted coordinates, which allows the structure to be used to create a dialog box or position a control within a dialog box.

Syntax


BOOL WINAPI MapDialogRect(
  _In_     HWND hDlg,
  _Inout_  LPRECT lpRect
);

Parameters

hDlg [in]

Type: HWND

A handle to a dialog box. This function accepts only handles returned by one of the dialog box creation functions; handles for other windows are not valid.

lpRect [in, out]

Type: LPRECT

A pointer to a RECT structure that contains the dialog box coordinates to be converted.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The MapDialogRect function assumes that the initial coordinates in the RECT structure represent dialog box units. To convert these coordinates from dialog box units to pixels, the function retrieves the current horizontal and vertical base units for the dialog box, then applies the following formulas:


left   = MulDiv(left,   baseunitX, 4);
right  = MulDiv(right,  baseunitX, 4);
top    = MulDiv(top,    baseunitY, 8);
bottom = MulDiv(bottom, baseunitY, 8);

If the dialog box template has the DS_SETFONT or DS_SHELLFONT style, the base units are the average width and height, in pixels, of the characters in the font specified by the template.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetDialogBaseUnits
Conceptual
Dialog Boxes
Other Resources
RECT

 

 

Community Additions

ADD
Show:
© 2014 Microsoft