2017-05-28 41 views
0

IE11でアプリケーションを強制的に開く必要がありません(ほとんどのボタンは1つのボタンの下にあります)ない)。vb.net(ウィンドウの代わりに)新しいIE11タブでリンクを開く

私は複数の方法を試してみましたが、結果は常に持つように同じである:それは、Firefox、またはChromeのために完璧に動作しますが、ために

Process.Start( "iexplore.exeを"、アドレス) IE - それは常に各リンクの新しいウィンドウを開きます。 IEに関係なく、すでに開かれているかどうか。

数年前、私は...私が推測IE7で働いていた同じようなことを書いた:

輸入SHDOCVW

Dim internetExplorerInstances As New ShellWindows() 
Dim foundIE As Boolean = False 

       foundIE = False 
       For Each ie As InternetExplorer In internetExplorerInstances 
        If ie.Name = "internet explorer" Then 
         ie.Navigate(address, &H800) 
         foundIE = True 
         Exit For 
        End If 
       Next 
       If Not foundIE Then 
        With oPro 
         .StartInfo.UseShellExecute = True 
         .StartInfo.Arguments = address 
         .StartInfo.FileName = "iexplore" 
         .Start() 
        End With 
       End If 

しかし、今日、IE 11で、それは動作しません.... I新しいウィンドウでURLを開くことを意味します。

新しいウィンドウではなく、新しいタブでリンクを開くようにプログラムで強制的にIE11を設定する方法はありますか?

答えて

1

一般に上記のコードは、1つの詳細を除いてOKである - それがあるべきである。

If IE.Name = "Internet Explorer" Then...それは大文字と小文字が区別されます。

Imports SHDocVw 

Const openInTab As Object = &H800 
Dim internetExplorerInstances As New ShellWindows() 

Public Function IsProcessOpen(ByVal name As String) As Boolean 
    For Each clsProcess As Process In Process.GetProcesses 
     If clsProcess.ProcessName.Contains(name) Then 
      Return True 
     End If 
    Next 
    Return False 
End Function 

(...)

およびコール:

は、最後に私のコードは次のようになります

   If IsProcessOpen("iexplore") Then 
        For Each IE As InternetExplorer In internetExplorerInstances 
         If IE.Name = "Internet Explorer" Then 
          IE.Navigate2(address, openInTab) 
          Exit For 
         End If 
        Next 
       Else 
        Process.Start("iexplore", address) 
       End If 

をそして、それは動作します:)

関連する問題