pop-up blocker and ActiveX controls, part three: creating a user initiated action
Note: This is part three in a series of posts explaining how ActiveX controls and the IE Pop-up Blocker should interact. The first post is here. If you are a user (and not an ActiveX control developer), and have found this post in an attempt to track down why you are still seeing unwanted pop-up windows, please refer to this post.
Problem: You have written an ActiveX control. You have done your due diligence in making sure it does the right thing as described in parts one and two of this series. Now you find a pop-up that should not be blocked is being blocked.
Example: A real life example happened to me a few days ago; a Microsoft control, in certain circumstances, launches a dialog and then tries to open a new window in response to certain options on that dialog. The user initiated action is long past at that point.
Solution: When we shipped WindowsXP SP2 we add two new commands to CGID_MSHTML (see mshtmcid.h in the latest SDK). The first is IDM_BEGINUSERACTION and the second is IDM_ENDUSERACTION. They are pretty self-explanitory. Send the first command to tell mshtml a user initiated action is beginning. You will be able to open a new window. Once you have opened your new window, send the second command to tell mshtml that the user action has finished.
For more info on sending commands to mshtml, see this post.
Comments
Anonymous
July 21, 2006
Interesting, those IDM_ commands...
It would be great to see this set of posts turned into a "formal" article or documentation in the MSDN Library.Anonymous
January 11, 2007
PingBack from http://www.ie7security.net/2007/01/11/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action/Anonymous
January 21, 2007
PingBack from http://www.ie7security.net/2007/01/21/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action-3/Anonymous
February 08, 2007
PingBack from http://www.ie7security.net/2007/02/08/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action-2/Anonymous
August 14, 2008
PingBack from http://www.ie7security.net/2008/08/14/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action-3/Anonymous
February 21, 2009
PingBack from http://www.ie7security.net/2009/02/21/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action-4/Anonymous
May 03, 2009
PingBack from http://www.ie7security.net/2009/05/03/pop-up-blocker-and-activex-controls-part-three-creating-a-user-initiated-action-5/Anonymous
June 13, 2009
PingBack from http://barstoolsite.info/story.php?id=4029