GetDC

From aldeid
Jump to navigation Jump to search

Description

The GetDC function retrieves a 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.

The GetDCEx function is an extension to GetDC, which gives an application more control over how and whether clipping occurs in the client area.

Spyware that takes screen captures often uses this function.

Syntax

HDC GetDC(
  _In_  HWND hWnd
);

Parameters

hWnd [in]
A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.

Return value

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

If the function fails, the return value is NULL.