I created this code that brings Internet Explorer window to the top.

        public void avtivateIEWin(IntPtr win){
            int foregrRes = SetForegroundWindow(win);
            log("foregrRes:" + foregrRes);
            ShowWindowAsync(win, SW_SHOW);
            SwitchToThisWindow(win, true); 
(the purposes of my program is to emulate Alt-Tab behavior to switch between my application's windows which are IE windows)

Yes..I included all possible functions in here... and it works Ok if I have only one IE window!

But when I have 2 IE windows, one of them opened with showModalDialog/showModlessDialog function - it doesn't work.

It looks weird but when I switch from the modal window to its parent, the focus goes from the modal window to the parent but the modal window is still on the top.

Please advise.

Thank you