From the help file I don't read any MDI related thing.
"The GetTopWindow function examines the Z order of the child windows associated with the specified parent window and retrieves a handle to the child window at the top of the Z order."
If you give the command the mIRC HWND it should return the topmost window which is connected down to the parent mIRC from the tree of windows.
Now desktop windows do not belong to mIRC so you won't be able to get those through any active window command that uses mIRC as a parent. If you never did the experience, if you have a top desktop dialog and you return $active with a timer in mIRC, it will give you the most top window in mIRC, not the actual dialog.
I think mIRC's $active gives what GetTopWindow( ) returns using the mIRC HWND as the parameter. This should give the top most Z order window be it a @window, dialog or any other window MDI attached or not to mIRC.
GetTopWindow( ) will get you the topmost Z ordered window from any parent. If you use the desktop window as a parent which is the root parent window of the system, then you could get the HWND of any window in the whole system which is topmost at any instant.
Desktop
|- mIRC
|- MDI
|- #channel
|- @window
|- dialog
...