This function returns the active window for HWND_DESKTOP, or other parent window.
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndParent; /* Parent-window handle for which the active window is required. */ HWND hwndActive; /* Active-window handle. */ hwndActive = WinQueryActiveWindow(hwndParent);