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

Our team have made a synchronous tools for IE(http://www.syncplus.net/en/ ).

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.

[693 byte] By [wangzhong] at [2008-2-14]
# 1

Hi,

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

Thanks
-Dave

DaveMassy at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 2

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.

wangzhong at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 3
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.
SharathUdupa at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 4

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

SharathUdupa at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 5

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?

wangzhong at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 6
In IE7, each tab loads a new instance of your BHO.
EricLaw-MSFT at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 7

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.

wangzhong at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 8
You can use IWebBrowser2::get_HWND and see if the new tab belongs under the same ancestor window or a new window.
SharathUdupa at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 9
Thank you, I will try it
wangzhong at 2007-8-31 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...