ReleaseDC function (winuser.h)
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
[in] hWnd
A handle to the window whose DC is to be released.
[in] hDC
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
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |