The WindowFromDC function returns the handle of the window associated with the given display device context (DC). Output functions that use the given device context draw into this window.
HWND WindowFromDC(
HDC hDC // handle of window
);
The return value is the handle of the window associated with the given DC. If no window is associated with the given DC, the return value is NULL.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Painting and Drawing Overview, Painting and Drawing Functions, GetDC, GetDCEx, GetWindowDC