SaveDC function (wingdi.h)

The SaveDC function saves the current state of the specified device context (DC) by copying data describing selected objects and graphic modes (such as the bitmap, brush, palette, font, pen, region, drawing mode, and mapping mode) to a context stack.

Syntax

int SaveDC(
  [in] HDC hdc
);

Parameters

[in] hdc

A handle to the DC whose state is to be saved.

Return value

If the function succeeds, the return value identifies the saved state.

If the function fails, the return value is zero.

Remarks

The SaveDC function can be used any number of times to save any number of instances of the DC state.

A saved state can be restored by using the RestoreDC function.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Device Context Functions

Device Contexts Overview

RestoreDC