惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - 陈锐

微软社区发布会总结(多图杀猫) 微软 Visual Studio 2008 社区发布全国巡展长沙站预报 让微软出钱捐助难民吧 能够下载时改名的文件权限管理 你的博客的性别是什么? 湖南微软开发者俱乐部成立大会顺利召开 湖南微软.NET俱乐部 成立大会事宜 RichTextBox技巧之插入图片(转载) RichTextBox技巧之插入表格(转载) RichTextBox技巧之插入上标和下标(转载) RichTextBox技巧之显示自定义高亮显示(转载) RichTextBox技巧之插入带格式文本(转载) VB 2005的写作进度 再VB 2005的拖放式数据绑定时遇到的问题 有些问题稍微想一下就明白了 写作进度(7月30日) Charles Petzold给撰书人的建议(from 思归的博客) 运行cl.exe编译发生:没有找到 mspdb80.dll 的解决办法 在VSTO 2005下创建的Office CommandBarButton不能定义在过程内
在VB.NET中如何使在Webbrowser中实现标签页中打开新链接
陈锐 · 2006-10-02 · via 博客园 - 陈锐

操作步骤:
1、在工程中添加COM的Microsoft Internet Controls的引用(这个引用对应的文件是shdocvw.dll,通常在system32目录下)。
2、添加如下代码:

Public Class Form1
    
Private Sub NewWindow3(ByRef ppDisp As ObjectByRef Cancel As Boolean, _
            
ByVal dwFlags As UInteger, _
            
ByVal bstrUrlContext As StringByVal bstrUrl As String)Dim xPage As TabPage = New TabPage
        xPage.Text 
= "abcd"
        TabControl1.TabPages.Add(xPage)
Dim x As New WebBrowser
        
DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).RegisterAsBrowser = True

        xPage.Controls.Add(x)
        x.Dock 

= DockStyle.Fill
        x.Visible 
= True

        x.Navigate(bstrUrl)
        Cancel 

= True
    
End SubPrivate Sub NewWindow2(ByRef ppDisp As ObjectByRef Cancel As Boolean)
        
Dim xPage As TabPage = New TabPage
        xPage.Text 
= "abcd"
        TabControl1.TabPages.Add(xPage)
Dim x As New WebBrowser
        
DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).RegisterAsBrowser = True

        xPage.Controls.Add(x)
        x.Dock 

= DockStyle.Fill
        x.Visible 
= True
        x.Navigate(
"about:blank")

        ppDisp 

= x.ActiveXInstance 'DirectCast(x.ActiveXInstance, SHDocVw.WebBrowser).Application
        'Cancel = True
    End SubPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
'在窗体载入后设置Webbrowser的NewWindow3事件处理函数
        'AddHandler DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).NewWindow3, AddressOf NewWindow3
        '如果不是Windows XP SP2的话需要监控NewWindow2消息
        AddHandler DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).NewWindow2, AddressOf NewWindow2

        WebBrowser1.Navigate(

"http://www.applevb.com")
    
End SubEnd Class

运行程序,可以看到新打开的窗口都会在TabControl1的新标签页中打开.在上面的代码中,如果是Windows XP+SP2的话可以监控NewWindow3事件,否侧需要监控NewWindow2事件。