Home All Groups Group Topic Archive Search About

Kill explorer process and disable it restart automatically

Author
27 Nov 2007 11:28 AM
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
////////////////////////////////////////////

Author
27 Nov 2007 3:40 PM
coolCoder
Show quote Hide quote
On Nov 27, 4:28 pm, "yxq" <ga***@163.net> wrote:
> 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

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you find this post helpful, please rate it.
Author
28 Nov 2007 6:12 AM
Joel Merk
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.

Show quoteHide quote
"yxq" wrote:

> 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
> ////////////////////////////////////////////
>
>
>
>
Author
28 Nov 2007 10:20 AM
yxq
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
///////////////////////////////////////////////


Show quoteHide quote
"Joel Merk" <JoelM***@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:2C7BD3B9-794E-43B7-8459-935E4DE42***@microsoft.com...
>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.
>
> "yxq" wrote:
>
>> 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
>> ////////////////////////////////////////////
>>
>>
>>
>>
>
Author
28 Nov 2007 10:24 AM
yxq
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

Show quoteHide quote
"Joel Merk" <JoelM***@discussions.microsoft.com> дÈëÏûÏ¢ÐÂÎÅ:2C7BD3B9-794E-43B7-8459-935E4DE42***@microsoft.com...
>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.
>
> "yxq" wrote:
>
>> 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
>> ////////////////////////////////////////////
>>
>>
>>
>>
>