1 out of 2 rated this helpful - Rate this topic

ReleaseDC function

Applies to: desktop apps only

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

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Device Contexts Overview
Device Context Functions
CreateDC
DeleteDC
GetDC
GetWindowDC

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ