windows_programming_notes.nbk: Home | Index | Next Page: message crackers | Previous Page: MAKEINTRESOURCE


 MapDialogRect

The 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 MapDialogRect(  
        HWND hDlg,
        LPRECT lpRect
    );

Parameters

Return Value

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.

Function Information


windows_programming_notes.nbk: Home | Index | Next Page: message crackers | Previous Page: MAKEINTRESOURCE


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time