[Ie programming] webbrowser control's multi-page browsing (Tabbed Browsing) development interface

Source: Internet
Author: User

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. <

     

     

     

     

     

     

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.