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.