This function returns the handle of the window that has the pointer captured.
#define INCL_WININPUT /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDesktop; /* Desktop-window handle. */ HWND hwnd; /* Handle of the window with the pointer captured. */ hwnd = WinQueryCapture(hwndDesktop);