For example =>
Dim processArray As Process() = Process.GetProcessesByName("iexplore")
For Each p As Process In processArray
p.Kill()
Next
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello & Thanks ;
I would like to kill the process "iexplore"
but can't figure out the syntax .
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
.
.
.
Dim localByName As Process() = Process.GetProcessesByName("iexplore")
localByName.kill()
Thanks for your Help...
For example =>
Dim processArray As Process() = Process.GetProcessesByName("iexplore")
For Each p As Process In processArray
p.Kill()
Next
Thanks Castorix31 ;
That works fine as a standalone ,
but now I want to put it into a MouseUp event .
Ultimately , I want to stop IE from Running .
I don't know how to Cancel a WebBrowser1.NewWindow Event
or even if the timing is right to stop it at this point (perhaps it has already opened IE ) .
So my thinking is to Catch a MouseUp Event, and just to be sure to Kill() IE .
But the following code doesn't work , It never gets there ,
what am I doing wrong ?
Or should I Post this as a new Issue ?
Private Sub WebBrowser1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
MsgBox("We are Here : Sub WebBrowser1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)")
Dim processArray As Process() = Process.GetProcessesByName("iexplore")
For Each p As Process In processArray
p.Kill()
Next
End Sub
Thanks
You can enumerate the ShellWindows collection to get Internet Explorer instances, then call IWebBrowser2::Quit on each instance.
See How to connect to a running instance of Internet Explorer.
The ShellWindows collection also exposes the DShellWindowsEvents event that you can use to monitor window creation.
Note if you silently kill IE windows and the user actually intent to open IE, the user would try to find what is the culprit and eventually remove your program.