Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SetViewportExtEx function

The SetViewportExtEx function sets the horizontal and vertical extents of the viewport for a device context by using the specified values.

Syntax


BOOL SetViewportExtEx(
  _In_   HDC hdc,
  _In_   int nXExtent,
  _In_   int nYExtent,
  _Out_  LPSIZE lpSize
);

Parameters

hdc [in]

A handle to the device context.

nXExtent [in]

The horizontal extent, in device units, of the viewport.

nYExtent [in]

The vertical extent, in device units, of the viewport.

lpSize [out]

A pointer to a SIZE structure that receives the previous viewport extents, in device units. If lpSize is NULL, this parameter is not used.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

The viewport refers to the device coordinate system of the device space. The extent is the maximum value of an axis. This function sets the maximum values for the horizontal and vertical axes of the viewport in device coordinates (or pixels). When mapping between page space and device space, SetWindowExtEx and SetViewportExtEx determine the scaling factor between the window and the viewport. For more information, see Transformation of Coordinate Spaces.

When the following mapping modes are set, calls to the SetWindowExtEx and SetViewportExtEx 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 SetWindowExtEx function before it calls SetViewportExtEx. Note that for the MM_ISOTROPIC mode certain portions of a nonsquare screen may not be available for display because the logical units on both axes represent equal physical distances.

Examples

For an example, see Invalidating the Client Area.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Coordinate Spaces and Transformations Overview
Coordinate Space and Transformation Functions
GetViewportExtEx
SetWindowExtEx
SIZE

 

 

Community Additions

Show:
© 2014 Microsoft