ResetDC

  HDC ResetDC(hdc, lpInitData)    
  HDC hdc; /* handle of device context to reset */
  LPDEVMODE lpInitData; /* pointer to DEVMODE structure */

The ResetDC function updates the specified device context, based on the information in a DEVMODE structure.

Parameters

hdc

Identifies the device context to update.

lpInitData

Points to a DEVMODE structure containing information about the new device context.

The DEVMODE structure has the following form:

typedef struct _devicemode { /* dvmd */

TCHAR dmDeviceName[32];

WORD dmSpecVersion;

WORD dmDriverVersion;

WORD dmSize;

WORD dmDriverExtra;

DWORD dmFields;

short dmOrientation;

short dmPaperSize;

short dmPaperLength;

short dmPaperWidth;

short dmScale;

short dmCopies;

short dmDefaultSource;

short dmPrintQuality;

short dmColor;

short dmDuplex;

short dmCollate;

TCHAR dmFormName[32];

} DEVMODE;

Return Value

The return value is the handle of the original device context if the function is successful. Otherwise, it is NULL.

Comments

An application will typically use the ResetDC function when a window receives a WM_DEVMODECHANGE message. ResetDC can also be used to change the paper orientation or paper bins while printing a document.

The ResetDC function cannot be used to change the driver name, device name or the output port. When the user changes the port connection or device name, the application must delete the original device context and create a new device context with the new information.

See Also

DeviceCapabilitiesEx, Escape, ExtDeviceModeEx