我有一个带有两个选项卡的选项卡控件,每个选项卡上都有一个WebBrowser控件。
我想在它们上面显示2个不同的Gmail帐户,但是一旦我通过WebBrowser1登录,WebBrowser2也会登录。
有没有一种方法可以实现我想要的效果?
有没有一种方法可以实现我想要的效果?
IE 8在UI中提供了“新会话”功能。我想象这个功能也可以在你自己的UI中实现。请参阅this article,了解它在UI中的工作原理。搜索Web浏览器控件文档,找到实现相同功能的方法。
这里有一些代码,可以让您访问InPrivate IE
Friend Function Open(Optional ByVal Url As String = "about:blank", Optional ByVal WindowState As ProcessWindowStyle = ProcessWindowStyle.Hidden) As WebBrowser
On Error Resume Next
Dim Start As New ProcessStartInfo
Dim Windows = New ShellWindowsClass
Dim Count = Windows.Count
Start.FileName = "iexplore.exe"
Start.Arguments = "-private -nomerge " & Url
If WindowState = ProcessWindowStyle.Hidden Then
Start.WindowStyle = ProcessWindowStyle.Minimized
Else
Start.WindowStyle = WindowState
End If
Process.Start(Start)
Wait.Reset()
Do
If Windows.Count > Count Then Exit Do
Loop While Wait.Waiting
Browser = Windows(Count)
Browser.Visible = (WindowState <> ProcessWindowStyle.Hidden)
Return Browser
End Function