I can get it to kill all processes just as I can list them below
Dim myprocesses() As Process
Dim myprocess As Process
myprocesses = Process.GetProc esses
For Each myprocess In myprocesses
Debug.WriteLine (myprocess.Proc essName)
Next
but the problem is I wouldn't want to kill all the processes. That
would be a problem. I want to exit all "applicatio ns" currently running.
Then again the whole idea probably will not work as many of the apps
written are home grown and probably would either not respond to a
shutdown request or would close abruptly w/o finishing up what they are
doing. And MS apps don't even need closing as the act of shutting down
windows causes them to shut down. How do they know windows is closing?
cj wrote:
Herfried,
I'm thinking of using this process too. If I use
MyProcess.Close MainWindow will the command wait for the other programs
to end before it returns or will it just issue a command to them to
close then move on to the next program?
Here's why, I'm looking to reboot the pc at 2am each day (you might have
read some of my questions on rebooting via program) and would like write
a program to do this but I want it to shutdown any other programs that
might be running before rebooting the pc.
Herfried K. Wagner [MVP] wrote: <ar********@gma il.com> schrieb: Private Sub KillExcel()
Dim myProcesses As Process
Dim myProcess As Process
myProcesses = Process.GetProc essesByName("EX CEL.EXE")
For Each myProcess In myProcesses
myProcess.Kill( )
Maybe it's better to use 'MyProcess.Clos eMainWindow()' instead of
calling the 'Kill' method.
myProcesses = Nothing
myProcess = Nothing
Setting the variables to 'Nothing' here doesn't make sense and doesn't
need to be done as it's done automatically when the method is left.