Login Register






[VB.Net] [Snippet] Anti-unwanted Process filter_list
Author
Message
[VB.Net] [Snippet] Anti-unwanted Process #1
Code:
Dim AntiProcess() As String = {"notepad", "mspaint", "taskmgr"} 'etc For intI As Integer = 0 To AntiProcess.GetUpperBound(0) 'Dim procFound As Integer = Process.GetProcessesByName(AntiProcess(intI)).Length For Each x As Process In Process.GetProcessesByName(AntiProcess(intI)) x.CloseMainWindow() 'or x.Kill() Next 'If procFound > 0 Then End Next

This will send close message / end all the Process (even multiple instances) in the AntiProcess() if they are not locked or have some other cool security.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [VB.Net] [Snippet] Anti-unwanted Process #2
Credits to [link=http://www.windowsitpro.com/article/registry2/how-can-i-stop-and-start-services-from-the-command-line-.aspx]WindowsITpro[/link]

Code:
Shell("net stop servicename") Shell("net stop superfetch") 'example
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [VB.Net] [Snippet] Anti-unwanted Process #3
I'm not sure, but it works. Just takes a few seconds.
[Image: rytwG00.png]
Redcat Revolution!

Reply

RE: [VB.Net] [Snippet] Anti-unwanted Process #4
Thank you for the snippet.
Tested and working great.
What is even more great, is you can add a timer and make it check if any of the apps is running at all time.

Code:
Public Class Form1 Sub protect() Dim AntiProcess() As String = {"notepad", "mspaint", "taskmgr"} 'etc For intI As Integer = 0 To AntiProcess.GetUpperBound(0) 'Dim procFound As Integer = Process.GetProcessesByName(AntiProcess(intI)).Length For Each x As Process In Process.GetProcessesByName(AntiProcess(intI)) x.CloseMainWindow() 'or x.Kill() Next 'If procFound > 0 Then End Next End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick protect() End Sub End Class
(This post was last modified: 04-04-2011, 04:21 AM by BreakR.)

Reply