重用在VB.net浏览器/标签 [英] Reusing browser/tab in VB.net

查看:97
本文介绍了重用在VB.net浏览器/标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Process.Start()打开一个URL,它非常适合一次性使用,但如果打开多个网址,它会创建将默认浏览器的新实例,或使用新的标签。我需要使用原来的标签。

I am using Process.Start() to open a URL and it's great for a one-time use but if opening multiple URLs it creates either a new instance of the default browser or uses a new tab. I need to use the original tab.

建议?

推荐答案

对于Internet Explorer,则需要在默认情况下引用位于 shdocvw.dll中 COM组件,在 C:\\ WINDOWS \\ SYSTEM32 \\ shdocvw.dll中。此COM组件包含您可以用它来确定是否有Internet Explorer的一个运行实例或没有,像这样的 ShellWindows 对象:

For Internet Explorer, you will need to reference the shdocvw.dll COM component located, by default, at c:\windows\system32\shdocvw.dll. This COM component contains a ShellWindows object that you can use to determine if there is a running instance of Internet Explorer or not, like this:

Dim internetExplorerInstances As New ShellWindows()

Dim foundIE As Boolean = False
For Each ie As InternetExplorer In internetExplorerInstances
If ie.Name = "Windows Internet Explorer" Then
        ie.Navigate(ur, &H800)
        foundIE = True
        Exit For
    End If
Next

If Not foundIE Then
    ' Either do nothing or use Process.Start with a new browser instance
End If

对于其他浏览器,你是不幸的是,出于运气,编程。

For the other browsers, you are, unfortunately,out of luck, programmatically.

这篇关于重用在VB.net浏览器/标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆