Export (0) Print
Expand All

ReleaseDC function

The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. It has no effect on class or private DCs.

Syntax


int ReleaseDC(
  _In_  HWND hWnd,
  _In_  HDC hDC
);

Parameters

hWnd [in]

A handle to the window whose DC is to be released.

hDC [in]

A handle to the DC to be released.

Return value

The return value indicates whether the DC was released. If the DC was released, the return value is 1.

If the DC was not released, the return value is zero.

Remarks

The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common DC.

An application cannot use the ReleaseDC function to release a DC that was created by calling the CreateDC function; instead, it must use the DeleteDC function. ReleaseDC must be called from the same thread that called GetDC.

Examples

For an example, see Scaling an Image.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Device Contexts Overview
Device Context Functions
CreateDC
DeleteDC
GetDC
GetWindowDC

 

 

Community Additions

ADD
Show:
© 2014 Microsoft