Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2010 When application closes, close a process?

$
0
0
Hey guys, so I am attempting to create a nice simple Anticheat.

So how do I make it so whenever my application closes, to kill a process?

I have:
Code:

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            killGame()
    End Sub

Which killgame() is just killing a process if its open.

So when I tried to this close my application via cmd or even taskmanager and yet it wil not kill the gameprocess?
So I tried possibly adding a timer to it (testing things out):

Code:

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If closeTimer.Enabled = False Then
            e.Cancel = True
            killGame()
            closeTimer.Enabled = True
        End If
    End Sub

and on the closeTimer's tick it will just do:
Application.exit()



Sooo how can I do this?
Someone help please. :c

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>