ResetDC

3.1

  #include <print.h>    

  HDC ResetDC(hdc, lpdm)    
  HDC hdc; /* handle of device context */
  const DEVMODE FAR* lpdm; /* address of DEVMODE structure */

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

Parameters

hdc

Identifies the device context to be updated.

lpdm

Points to a DEVMODE structure containing information about the new device context. The DEVMODE structure has the following form:

#include <print.h>

typedef struct tagDEVMODE {   /* dm */
    char  dmDeviceName[CCHDEVICENAME];
    UINT  dmSpecVersion;
    UINT  dmDriverVersion;
    UINT  dmSize;
    UINT  dmDriverExtra;
    DWORD dmFields;
    int   dmOrientation;
    int   dmPaperSize;
    int   dmPaperLength;
    int   dmPaperWidth;
    int   dmScale;
    int   dmCopies;
    int   dmDefaultSource;
    int   dmPrintQuality;
    


    int   dmColor;
    int   dmDuplex;
    int   dmYResolution;
    int   dmTTOption;
} DEVMODE;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

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.

Before calling ResetDC, the application must ensure that all objects (other than stock objects) that had been selected into the device context have been selected out.

See Also

DeviceCapabilities, Escape, ExtDeviceMode