Kill explorer process and disable it restart automatically

  • Thread starter Thread starter yxq
  • Start date Start date
Y

yxq

Hello,
I want to kill the Explorer process, after Explorer process has been killed,
it will restart automatically immediately. How to disable it restart
automatically? for example, in Windows Task Manager, you can kill explorer
process, but it will not restart automatically.

My code:

/////////////////////////////////////////////
For Each ObjPro As Process In Process.GetProcessesByName("EXPLORER")
ObjPro.Kill()
Do Until ObjPro.HasExited = True
Application.DoEvents()
Loop
Next
////////////////////////////////////////////
 
Hello,
I want to kill the Explorer process, after Explorer process has been killed,
it will restart automatically immediately. How to disable it restart
automatically? for example, in Windows Task Manager, you can kill explorer
process, but it will not restart automatically.

My code:

/////////////////////////////////////////////
For Each ObjPro As Process In Process.GetProcessesByName("EXPLORER")
ObjPro.Kill()
Do Until ObjPro.HasExited = True
Application.DoEvents()
Loop
Next
////////////////////////////////////////////

Hi,
May I know why you want to kill Explorer process from your code,
since this is a System process ? May be there is workaround for your
problem.
Also please specify more details about your actual problem.


Thanks,
coolCoder
 
I have found that using a loop (possibly within a separate thread, or perhaps
a timer, depending on how you want to do it) to constantly check if Explorer
has restarted, and then kill it again works well. After a while, it stops
automatically restarting. Not that I recommend doing it, but if you feel that
you need to, then that's how I suggest doing it.
 
I have done successfully.
///////////////////////////////////////////////////////////////
Public Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As
IntPtr, ByVal uExitCode As UInteger) As Integer

For Each ObjPro As Process In Process.GetProcessesByName("EXPLORER")
TerminateProcess(ObjPro.Handle, 1)
Do Until ObjPro.HasExited = True
Application.DoEvents()
Loop
Next
///////////////////////////////////////////////
 
Public Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As
IntPtr, ByVal uExitCode As UInteger) As Integer

For Each ObjPro As Process In Process.GetProcessesByName("EXPLORER")
Do Until TerminateProcess(ObjPro.Handle, 1)
Application.DoEvents()
Loop
Next
 
Back
Top