更改IE标签URL [英] Change IE Tab URL

查看:61
本文介绍了更改IE标签URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改IE标签的URL.

代码1:

I want to change the IE tab URL.

Code 1:

Imports mshtml

Public Class Form1

~~~~~~~~~~~~~~~~~~~

    Dim WithEvents IE As SHDocVw.InternetExplorer
    Dim WithEvents CurrentDoc As HTMLDocument

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim SWs As New SHDocVw.ShellWindows
        Dim IEx As SHDocVw.InternetExplorer
        Dim i As Integer = 1
        Timer1.Enabled = False
        For Each IEx In SWs
            Try
                If TypeOf (IEx.Document) Is HTMLDocument Then
                    IE = IEx
                    CurrentDoc = IE.Document
                    CurrentDoc.url = "http://google.com"
                End If
                i = i + 1
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        Next
    End Sub



~~~~~~~~~~~~~~~~~~~~~~~~~

还有

代码2:



~~~~~~~~~~~~~~~~~~~~~~~~~~~

And

Code 2:

Imports SHDocVw

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim browser As SHDocVw.InternetExplorer
        Dim myLocalLink As String
        Dim myDoc As mshtml.IHTMLDocument
        Dim shellWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindows()
        Dim filename As String
        For Each ie As SHDocVw.InternetExplorer In shellWindows
            filename = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower()
            If filename = "iexplore" Then
                browser = ie
                myDoc = browser.Document
                myLocalLink = myDoc.url
                myDoc.url = "http://www.google.com"
                ''MessageBox.Show(myLocalLink)
            End If
        Next
    End Sub



在代码1和代码2下都将移动IE的URL.

但是..所有选项卡都导航到URL(google).

我想更改活动选项卡的URL.



Under both Code 1 and Code 2 is going to move IE''s URL.

But.. All tabs navigate to the URL(google).

I want to change the active tab''s URL.

推荐答案

IE现在为每个选项卡创建一个新进程.因此,遍历所有IE的所有选项卡页都将通过.

也许此链接可以帮助您:

http://social.msdn.microsoft.com/论坛/en-US/vbgeneral/thread/60c6c95d-377c-4bf4-860d-390840fce31c [ http://www.eggheadcafe.com/community/aspnet/2/10112922/how-to-get-current-active-tab-handle-in-an-ie7-window-using-c.aspx [
IE now creates a new process for each tab. By traversing all IE''s will therefore go by all tabpages.

Maybe this link can help:

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/60c6c95d-377c-4bf4-860d-390840fce31c[^]

And take a look here:

http://www.eggheadcafe.com/community/aspnet/2/10112922/how-to-get-current-active-tab-handle-in-an-ie7-window-using-c.aspx[^]

Good luck!


这篇关于更改IE标签URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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