From IE7, ie supports multi-page (Tab) browsing. The Web browser control of IE also provides the multi-page browser development interface. For backward compatibility, this interface is blocked by default. Suppose you use the webbrowser control to develop a browserMytabbrowser,You will find that the "open in new tab" item in the right-click menu is gray (for example ).
To enable this function, you need to create a DWORD value with the value of your own file name in the registry:
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
Software
Microsoft
Internet Explorer
Main
Featurecontrol
Feature_tabbed_browsing
Mytabbrowser.exe= Zero X 00000001
After the multi-page browser development interface is enabled, your programMytabbrowserYou can respond to the "open in new tab" request like IE. IE defines the following three types of requests whose actions are "open in new tab ".
1) you can right-click the "open in new tab" item in the menu.
2) the user clicks the link with the shortcut key.
3) press Ctrl to click the link.
This request will trigger the dwebbrowserevents2: newwindow3 event. The event parameter dwflags indicates the request type:
Nwmf_forcewindow: Open the link in a new window.
Nwmf_forcetab: Open the link in the new tab.
The following is a simple example of how to handle the event:
Void _ stdcall oneventnewwindow3 (idispatch ** ppdisp, variant_bool * cancel, DWORD dwflags, BSTR bstrurlcontext, BSTR bstrurl) <br/>{< br/> If (dwflags & packages) // open in a new tab <br/>{< br/> ccomptr <iwebbrowser2> spbrowser = opennewtab (); // create a new tab and return the iwebbrowser2 pointer <br/> If (spbrowser) <br/>{< br/> hresult hR = spbrowser-> QueryInterface (iid_idispatch, (void **) Ppdisp); <br/> * cancel = succeeded (HR )? Variant_false: variant_true; <br/>}< br/> else if (dwflags & nwmf_forcewindow) // open in a new window <br/>{< br/> ..... <br/>}< br/>}
> Original article copyright belongs to the author, reprint please indicate the source and author information (http://blog.csdn.net/WinGeek/), thank you. <