Drawing3d documented Class Library

FeaturesW32.ReleaseDC Method

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.

[Visual Basic]
<PreserveSig> _
<DllImport(EntryPoint:="ReleaseDC", CharSet:=CharSet.None, SetLastError:=False, ExactSpelling:=False, PreserveSig:=True, CallingConvention:=CallingConvention.StdCall, BestFitMapping:=False, ThrowOnUnmappableChar:=False, Value:="user32.dll")> _
<SuppressUnmanagedCodeSecurity> _
Public Shared Sub ReleaseDC( _
   ByVal windowHandle As IntPtr, _
   ByVal deviceContext As IntPtr _
[DllImport(EntryPoint="ReleaseDC", CharSet=CharSet.None, SetLastError=False, ExactSpelling=False, PreserveSig=True, CallingConvention=CallingConvention.StdCall, BestFitMapping=False, ThrowOnUnmappableChar=False, Value="user32.dll")]
public static bool ReleaseDC(
   IntPtr windowHandle,
   IntPtr deviceContext



Handle to the window whose DC is to be released.


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 true.

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


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

See Also

FeaturesW32 Class | Drawing3d.OS.Windows Namespace | GetDC