The GetLastActivePopup function determines which pop-up window owned by the specified window was most recently active.
HWND GetLastActivePopup(
HWND hWnd // handle to owner window
);
The return value identifies the most recently active pop-up window. The return value is the same as the hWnd parameter, if any of the following conditions are met:
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.
Windows Overview, Window Functions, AnyPopup, ShowOwnedPopups