Alert modal dialog box - parent window class name - IE8 and IE9

Pertanyaan Alert modal dialog box - parent window class name - IE8 and IE9

  • 14 Februari 2012 14:35
     
     

    Hi,

    I have an activeX application, which is used to identify and capture the alert modal dialog box (of class type #32770) pops-up from my web application

    For this, I am getting the window handle of the alert dialog box, fetch its parent handle and also the parent window class name using GetParent() and GetClassName() respectively.
    In order to make sure that the dialog box is invoked from my web application, I compare the Parent handle with the parent window handles that I already have.

    When tested with Internet Explorer 8, it returns the parent window class name for the dialog box as "IEFrame". I get the parent window handle as I expect and it matches with my handles list.

    But in Internet Explorer 9, the parent window class name for the dialog box is returned as "Alternate Modal Top Most". Also, the parent handle obtained is not matching with the list of parent window handles that I have.

    My question is why the parent window class name for alert modal dialog box is different for IE8 and IE9?

    And also, what is the correct way for verifying the alert dialog box is invoked from my web application in IE9.

    Thanks,

    -Vijay-

Semua Balasan

  • 14 Februari 2012 17:42
     
     

    I can only say that the "Alternate Modal Top Most" window also appears in IE8.... sometimes.  I exchanged words with a Microsoft expert some time ago about the inconsistencies of modal boxes in IE8 but it wasn't fruitful.

    You should know that Internet Explorer hooks into the dialog box creation process using MS Detours.  Any call to DialogBoxParam() is diverted to an internal function in ie<something>.dll (can't remember right now, could be ieframe.dll).  This is done in order to control the order of dialog boxes in the different tabs.  Or said differently:  IE8 "serializes" the dialog boxes into a queue so only one box at a time is shown.  Dialog boxes coming from tabs that are not active (not the foreground or selected tab) are simply waiting and IE notifies the user by making the tab blink.

    In my very limited experience, IE8's detouring of the dialog boxes works only sometimes.  If you get the "Alternate Modal Top Most" window, then the detouring process worked OK, but if you don't, then multiple dialog boxes may appear at the same time!  I verified this popping message boxes and task dialogs from 3 different tabs at the same time.

    I haven't explored the behavior of dialog boxes in IE9 yet because my company hasn't moved to IE9, so I cannot really comment on it.  However, it sounds from your post that the dialog box detour mechanism in IE9 may be working better than in IE8 if you consistently get this "Alternate Modal Top Most" window.

    Read more about this topic here: http://msdn.microsoft.com/en-us/library/ie/cc994365(v=vs.85).aspxhttp://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/289d4b9c-7168-46ad-aeb6-5c8e835d0ae4http://blogs.msdn.com/b/freeassociations/archive/2008/11/04/ieprocess-h-ie-inproc-apis.aspx.


    Jose R. MCP

  • 15 Februari 2012 15:33
     
     

    Thanks for your reply Jose. I got some insight in to the problem.

    Till now, I haven't faced this "Alternate Modal Top Most" window problem in IE8.

    I am curious to know whether the problem that you have posted at http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/289d4b9c-7168-46ad-aeb6-5c8e835d0ae4 got solved? If so, how? 

    Using MS Detours, If the IE 8 and IE 9 serializes the dialog boxes and sends to the individual tab(s), how come IE is able to identify to which tab, it has to send which Dialog Box. I assume that there should be some method or API to find out the parent of the Dialog box / "Alternate Modal Top Most" window. If so, that would more helpful for me.

    I am raising the question again to fellow IE developers

    As I already have the parent window handle, I even tried to get the child windows associated for this parent window by using the "EnumChildWindows()". Even this way, I am not getting the parent window handle of "Alternate Modal Top Most".  

    How to get and compare the window handle of Dialog box / Alternate Modal Top Most window with its parent window (i.e. from the tab / window, the dialog window got originated) in IE 9 (or IE 8)?

    P.S. I am newbie into the IE Development. So, my questions may be very basic. 

    Thanks,
    -Vijay-


    • Diedit oleh --Vijay-- 15 Februari 2012 15:42 to understand the problem clearly
    •  
  • 15 Februari 2012 16:05
     
     

    I did NOT resolve the problem.  I am simply at the mercy of IE8's inconsistent behavior.  The API function that you seem to want is WaitForTabWindow(), but as I explained in my post, the function seems broken in IE8.  Maybe it works in IE9??

    Oh, and IE probably knows the tab by examining the PID and TID of the calling process.


    Jose R. MCP


  • 22 Februari 2012 19:34
     
     

    Things like window class names and such are internal implementation details.  Which means you can't rely on them, because the IE team can change them any time they want.  You know this, because they are not documented.  Jose's explanation of the IE tab dialog queue is correct.  IE knows which tab an alert belongs to because it knows its own window handles and it knows the parent of the alert that is passed to DialogBoxParam() or whatever API.  There is more than one way to create a dialog box in Windows, and the different behavior you're seeing could be related to different ways of opening dialogs.  We don't know because it's not documented.

    Why are you trying to do this thing you're doing? There may be a better way.

  • 27 Februari 2012 11:42
     
     

    Hi Jeffdav,

    I am not creating a dialog box in Windows. I am just capturing the existing one.

    To elaborate in detail,  I have a web application which will display dialog pop-up box like OK / Cancel or Yes / No confirmation, Browse file folder dialog box to upload a file and so-on.

    For testing the web application, we developed an active X application which will capture (in other words record) the dialog box (or pop-up) initiated from the web application. This is done in order to verify whether the alert dialog box is pop-ed up by our web application or by some web-site loaded in IE.

    As I said in my first post in this topic, the parent handle of the alert dialog box was compared with the list of parent window handles that I already have / registered.

    This worked perfect till IE 8, as it returned the parent window class name for the dialog box as "IEFrame" and the parent window handles were matched. Whereas from IE 9, the parent window class name for the dialog box was returned as "Alternate Modal Top Most" and the parent window handled differed.

    So, I was not able to find out whether the Dialog box was emerged from our web application or some other.  

    Right now, it seems like the only way to solve my problem in IE 9 is to check with the window thread process ID.
    Any other way to solve would really helpful.

    Thanks,
    -Vijay-