DWORD SetWindowExt(hDC,X,Y)
This function sets the x- and y-extents of the window associated with the specified device context. The window, along with the device-context viewport, defines how GDI maps points in the logical coordinate system to points in the device coordinate system.
The x- and y-extents of the window define how much GDI must stretch or compress units in the logical coordinate system to fit units in the device coordinate system. For example, if the x-extent of the window is 2 and the x-extent of the viewport is 4, GDI maps two logical units (measured from the x-axis) into four device units. Similarly, if the y-extent of the window is 2 and the y-extent of the viewport is –1, GDI maps two logical units (measured from the y-axis) into one device unit.
The extents also define the relative orientation of the x- and y-axes in both coordinate systems. If the signs of matching window and viewport extents are the same, the axes have the same orientation. If the signs are different, the orientation is reversed. For example, if the y-extent of the window is 2 and the y-extent of the viewport is –1, GDI maps the positive y-axis in the logical coordinate system to the negative y-axis in the device coordinate system. If the x-extents are 2 and 4, GDI maps the positive x-axis in the logical coordinate system to the positive x-axis in the device coordinate system.
Parameter | Type/Description |
hDC | HDC Identifies the device context. | |
X | int Specifies the x-extent (in logical units) of the window. | |
Y | int Specifies the y-extent (in logical units) of the window. |
The return value specifies the previous extents of the window (in logical units). The y- extent is in the high-order word; the x-extent is in the low-order word. If an error occurs, the return value is zero.
When the following mapping modes are set, calls to the SetWindowExt and SetViewportExt functions are ignored:
MM_HIENGLISH
MM_HIMETRIC
MM_LOENGLISH
MM_LOMETRIC
MM_TEXT
MM_TWIPS
When MM_ISOTROPIC mode is set, an application must call the SetWindowExt function before calling SetViewportExt.