Dont Fire NewWindow3 when new TAB is opened by CTRL+T.  
Author Message
wangzhong





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

Our team have made a synchronous tools for IE( http://www.hide-link.com/ ).

Recently, I am doing an upgrade for IE7 in Vista RC1,

but have a problem about the NewWindows3 event.

The NewWindows3 event is fired by the following case.

1)Choose the "Open in New Tab" command from a link's shortcut menu.

2)Click the link with the middle mouse button.

3)Click the link while holding the CTRL key.

But can't be fired by the following

1) CTRL+T

2) Directly click the empty tab.

Would you like give me some advise thank you.




Internet Explorer Development3  
 
 
Dave Massy





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

Hi,

Can you give an idea of from where you are listening for the event and how

Thanks
-Dave



 
 
wangzhong





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

I sink the DWebBrowserEvents2 in my Toolbar.

AtlAdvise(m_pIWebBrowser2, m_pUnk, DIID_DWebBrowserEvents2, &m_dwCookie);

I can receive the NewWindow3+NewWindow2 event when I open a Tab

by the "Open in New Tab" command.



 
 
Sharath Udupa





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

There is no relationship between opening a new tab using Ctrl+T and the existing IWebBrowser2s (of the existing) tabs. The event is fired only when you open a link from a particular IWebBrowser2 since its originating from that.
 
 
Sharath Udupa





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

Also, in IE7 the toolbar and BHOs are part of the tab, so whenever a new tab is created by the user a new instance of your toolbar would be created and passed the IWebBrowser2 of the new tab in the IObjectWithSite::SetSite. That should enable you to keep track of each tab in IE7.

Also for more information regarding how tabs are implemented in IE7 checkout this blog post http://blogs.msdn.com/ie/archive/2005/05/26/422103.aspx


 
 
wangzhong





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

I can get your meaning.

For IE 6, I have kept track of each window in my toolbar which it implemented IObjectWithSite::SetSite ().

There is no problem, because IE6 only can open the window.

But in IE7, if IObjectWithSite::SetSite () is called, how can I know it is a TAB, not a window



 
 
EricLaw-MSFT





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

In IE7, each tab loads a new instance of your BHO.
 
 
wangzhong





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

I am sorry, the problem I want to know as follows:

In IE7, if IObjectWithSite::SetSite () is called, how can I know it is a NEW tab in an existent window,

not a NEW tab in a NEW window.

 



 
 
Sharath Udupa





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

You can use IWebBrowser2::get_HWND and see if the new tab belongs under the same ancestor window or a new window.
 
 
wangzhong





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

Thank you, I will try it

 
 
Sheng Jiang (?晟)





PostPosted: Internet Explorer Extension Development, Dont Fire NewWindow3 when new TAB is opened by CTRL+T. Top

IWebBrowser2::HWND

For compatibility reasons, this method returns a handle to the top-level window frame, consistent with previous versions of Internet Explorer. However, due to tabbed browsing in Internet Explorer 7, this window handle is not logically the same as in previous versions.

See http://msdn2.microsoft.com/en-us/library/aa752126.aspx