How to enable inPrivate mode in the WebBrowser control

后端 未结 2 1106
天命终不由人
天命终不由人 2020-12-19 00:58

I have to make a IE type browser with some extra features on it.

In Visual Studio, we have a component named \"WebBrowser\" that uses current IE browser installed in

相关标签:
2条回答
  • 2020-12-19 01:24

    Here's some code that will give you access to an 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 is my own class that waits for 10 secs
    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
    
    0 讨论(0)
  • 2020-12-19 01:37

    According to EricLaw's answers on a related question, it sounds like this might not be possible.

    You might be stuck making your own control or looking for an alternative one.

    0 讨论(0)
提交回复
热议问题