This function returns the device context for a given window.
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwnd; /* Window handle. */ HDC hdc; /* Device-context handle. */ hdc = WinQueryWindowDC(hwnd);