0
votes

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);
        BringWindowToTop(win);
        SetActiveWindow(win);
        SwitchToThisWindow(win, true); 
        SetFocus(win); 

}

(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

1

1 Answers

1
votes

That's how modal windows work -- they will always display above the parent window when the parent is visible, and there's no way to change this behaviour.

MSDN has more information on owner windows, specifically it mentions that:

An owned window is always above its owner in the z-order.