VB: Unkillable Proccess

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts Page 1 of 1
Contributors
User avatar
n1kk0
Just Registered
Just Registered
Posts: 1
Joined: Sat Apr 16, 2016 7:49 am

VB: Unkillable Proccess
n1kk0
Hello, I'm trying to make a process killer but I want to make it bulletproof. What I mean about bulletproof is,
I want to make my program unkillable if killed using my own program. Thanks to who'll help.
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: VB: Unkillable Proccess
comathi
I apologize for my ignorance, but wouldn't this be as simple as comparing the process ID of your program to the ID of the process you want to kill and make sure they're not the same?

VB.NET has a method called Process.GetCurrentProcess() which returns an object corresponding to the process of the current program. If I'm not mistaken, it should then be a simple matter of comparing IDs.
Code: Select all
Dim myProcess As System.Diagnostics.Process = System.Diagnostics.Process.GetCurrentProcess()

If myProcess.Id <> otherProcess.Id Then
    'Kill process
End If
2 posts Page 1 of 1
Return to “Coding Help & Support”