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