CWnd* GetLastActivePopup() const;
Determines which pop-up window owned by CWnd was most recently active.
Identifies the most recently active pop-up window. The return value will be the CWnd itself if any of the following conditions are met:
CWnd itself was most recently active.
CWnd does not own any pop-up windows.
CWnd is not a top-level window or is owned by another window.
The pointer may be temporary, and should not be stored for later use.
::GetLastActivePopup