User32GetDC(SafeHandle) Method

Retrieves a IntPtr handle to a device context (DC) for the client area of a specified window or for the entire screen.

You can use the returned handle in subsequent GDI functions to draw in the DC.

The device context is an opaque data structure, whose values are used internally by GDI.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll")]
public static IntPtr GetDC(
	SafeHandle hWnd
)

Parameters

hWnd  SafeHandle
A IntPtr handle to the window whose DC is to be retrieved.

If this value is Zero, GetDC(IntPtr) retrieves the DC for the entire screen.

Return Value

IntPtr
If the function succeeds, the return value is a IntPtr handle to the DC for the specified window's client area.

If the function fails, the return value is Zero.

Remarks

See Also