GetHWnd

The function is used to get the handle of the graphics window.

HWND GetHWnd();

Parameters

None

Return Value

Returns the handle of the graphics window.

Remarks

In Windows, a handle is the identity of a window, and once you get the handle, you can use the functions in the Windows API to gain control over the window.

Note that do not get the DC of the window from the window handle and then use the GDI function to perform a drawing operation on the window. Because of the implementation mechanism, use the GetImageHDC function to get the DC of the window.

Examples

// Gets the handle of the graphics window.
HWND hWnd = GetHWnd();
// Use the Windows API to modify the window name
SetWindowText(hWnd, "Hello!");