GetViewportExt

2.x

  DWORD GetViewportExt(hdc)    
  HDC hdc; /* handle of device context */

The GetViewportExt function retrieves the x- and y-extents of the device context's viewport.

Parameters

hdc

Identifies the device context.

Return Value

The low-order word of the return value contains the x-extent, in device units, if the function is successful; the high-order word contains the y-extent.

Example

The following example uses the GetViewportExt function and the LOWORD and HIWORD macros to retrieve the x- and y-extents for a device context:

HDC  hdc;
DWORD dw;
int xViewExt, yViewExt;

hdc = GetDC(hwnd);
dw  = GetViewportExt(hdc);
ReleaseDC(hwnd, hdc);
xViewExt = LOWORD(dw);
yViewExt = HIWORD(dw);

See Also

SetViewportExt