How to stop Explorer.Exe in VB.NET

Please help me!

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 6160 Views - Last Post: 11 July 2008 - 07:16 AM Rate Topic: -----

#1 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 03:03 AM

is there any way in Visual basic 2008 express edition

to stop a process like umm......Explorer.exe

i was planning on making a fake virus to sent to my friend but i want it to shutdownthe explorer process

but i cant seem to figure it out ive tryied the kill() code but that hasn't got the effect i want

like in the taskmanager you can end a process cant you .

i want to do that but in visual basic instead

This post has been edited by Trickster090: 03 June 2008 - 05:16 AM

Is This A Good Question/Topic? 0
  • +

Replies To: How to stop Explorer.Exe in VB.NET

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 05:47 AM

Well, we wont just write this code for you, thats not how we operate here at Dream.In.Code, but I can at least send you down the right path. You're going to want to research the Process Class, which is a member of the System.Diagnostics Namespace.

That will give you what you need to know in order to accomplish this (though I truly hope it's not for malicious activity). Read through the links I provided, check out the properties, methods and events of the Process class. Once you have some code written where you've tried to accomplish this and are running into problems, post the code (inside code tags => :code: ) and a detailed explanation of what is happening and any error messages you may be receiving :)


Also, Visual Basic 2008 is VB.NET so this is being moved to the proper forum
Was This Post Helpful? 0
  • +
  • -

#3 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

Re: How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 05:53 AM

i've been looking throught the MSDN libary for VB but i canseem to find how to end a process i fond how to start by using

process.start
would i bee right in thinking that it maybe
process.end????

or would i have to edit this in some sort of way ???

 Dim instance As Process

instance.Kill()



This post has been edited by Trickster090: 03 June 2008 - 05:54 AM

Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 06:23 AM

Well you're going to want to loop through all the processes that are running on the system, the easiest way to accomplish this is to use the GetProcesses Method of the Process class.


'here we're going to get a list of all running processes on
'the computer
For Each clsProcess As Process In Process.GetProcesses



Then inside your loop look for a process named Explorer (leave the .exe off the name). Use the ProcessName Property of the Process class


If clsProcess.ProcessName.ToLower.StartsWith("explorer") Then




Inside the If statement, meaning it found the process name you are looking for, call the Kill Method of the process class


clsProcess.Kill()




Add all this into it's own function and you end up with


Public Function FindAndKillProcess(ByVal name As String) As Boolean
    'here we're going to get a list of all running processes on
    'the computer
    For Each clsProcess As Process In Process.GetProcesses
        'now we're going to see if any of the running processes
        'match the currently running processes by using the StartsWith Method,
        'this prevents us from incluing the .EXE for the process we're looking for.
        '. Be sure to not
        'add the .exe to the name you provide, i.e: NOTEPAD,
        'not NOTEPAD.EXE or false is always returned even if
        'notepad is running
        If clsProcess.ProcessName.StartsWith(name) Then
            'since we found the proccess we now need to use the
            'Kill Method to kill the process. Remember, if you have
            'the process running more than once, say IE open 4
            'times the loop thr way it is now will close all 4,
            'if you want it to just close the first one it finds
            'then add a return; after the Kill
            clsProcess.Kill()
            'process killed, return true
            Return True
        End If
    Next
    'process not found, return false
    Return False
End Function




Hope this helps :)
Was This Post Helpful? 0
  • +
  • -

#5 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

Re: How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 06:53 AM

will this work if i want to kill the process Explorer.exe
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to stop Explorer.Exe in VB.NET

Posted 03 June 2008 - 07:28 AM

If Not FindAndKillProcess("explorer") Then

Else

End If




As stated in my post, pass the name of the process you're looking for (minus the extension, for notepad you would pass notepad) and it will kill that process.
Was This Post Helpful? 0
  • +
  • -

#7 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

Re: How to stop Explorer.Exe in VB.NET

Posted 04 June 2008 - 05:27 AM

can you give that to me as a full code

because i can't seem to get it to work (SORRY)

This post has been edited by Trickster090: 04 June 2008 - 05:28 AM

Was This Post Helpful? 0
  • +
  • -

#8 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Re: How to stop Explorer.Exe in VB.NET

Posted 04 June 2008 - 05:38 AM

Post the code that isn't working then. We won't be writing full code for you until you can show a good faith effort on your behalf. :)
Was This Post Helpful? 0
  • +
  • -

#9 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

Re: How to stop Explorer.Exe in VB.NET

Posted 05 June 2008 - 02:02 AM

ok.....seem to got it to work

if there is any problem ill check back to you guys ok :)

you have been a really big help THX
Was This Post Helpful? 0
  • +
  • -

#10 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to stop Explorer.Exe in VB.NET

Posted 05 June 2008 - 03:08 PM

hey u should know something
the vb.net projects doesnt work without .net framwork
so if ur friend doesnt have .netframework,the project will not work
Was This Post Helpful? 0
  • +
  • -

#11 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to stop Explorer.Exe in VB.NET

Posted 12 June 2008 - 09:53 AM

hmm this code doesn't stop explorer but may be other programmes as internet expolorer and some times can't stop yahoo
Was This Post Helpful? 0
  • +
  • -

#12 Trickster090  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 41
  • Joined: 02-June 08

Re: How to stop Explorer.Exe in VB.NET

Posted 08 July 2008 - 02:45 AM

no i wanted to kill the windows Explorer you know the taskbar.
Was This Post Helpful? 0
  • +
  • -

#13 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to stop Explorer.Exe in VB.NET

Posted 08 July 2008 - 05:33 AM

well there is something strange i noticed when typing the following code
public class form1
dim x as integer

private sub form1_load(byval sender as system.object,byva e as system.eventargs)handles mybase.load
timer1.interval=1000
timer1.start()
end sub

private sub timer1_tick(byval sender as system.object,byval e as system.eventargs)handles timer1.tick
x+=1
if x=3 then
for each a as process in process.getprocess()
if a.processname.start with("explorer") then
a.kill()
me.close()
end sub
end class

using me.close really closes the windows
does anybody know why?

This post has been edited by narmer93: 08 July 2008 - 05:34 AM

Was This Post Helpful? 0
  • +
  • -

#14 Rickster0  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 16
  • View blog
  • Posts: 236
  • Joined: 08-July 08

Re: How to stop Explorer.Exe in VB.NET

Posted 10 July 2008 - 02:38 AM

i don't think your friend would find that very funny
Was This Post Helpful? 1
  • +
  • -

#15 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to stop Explorer.Exe in VB.NET

Posted 10 July 2008 - 07:19 AM

^?????????????
oh i now noticed,he said that he wants to make i to send it to a friend
who do u think will like to have his computer wih virus detected?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2