[Hep]injector checkbox

Posts 1–4 of 4 · Page 1 of 1
I need to create an checkbox that closes aplication the after the injection be made

I use code for inject manual
Code:
If closebox.Checked = True Then
            Me.Close()
        End If

this code no work for inject auto


Code:
Private Sub TextBoxProcess_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxProcess.TextChanged
        If Autoinject.Checked AndAlso tmrAutoInject.Enabled = False Then
            tmrAutoInject.Start()
        End If
    End Sub

Private Sub Autoinject_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Autoinject.CheckedChanged
        If Autoinject.Checked Then
            tmrAutoInject.Enabled = True
            tmrAutoInject.Interval = 100
            tmrAutoInject.Start()
        Else
            tmrAutoInject.Stop()
            tmrAutoInject.Enabled = False
        End If
    End Sub

    Private Sub tmrAutoInject_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrAutoInject.Tick
        Try
            TextBoxProcess.Text = TextBoxProcess.Text.Replace(".exe", "")
            Dim validProc As Boolean = Process.GetProcessesByName(TextBoxProcess.Text).GetUpperBound(0) + 1
            If validProc Then
                tmrAutoInject.Stop()
                Call inject()
                tmrAutoInject.Enabled = False
            End If
        Catch ex As Exception
            MsgBox("An unknown error has occured", MsgBoxStyle.Exclamation, "Warning!")
        End Try
If closebox.Checked = True Then
            Me.Close()
        End If
    End Sub
I discovered
/solved
Maybe share the solution?
When your function injects successfully return 1 or else a negative number. And just check to see if the function returns 1 and if it does do me.exit
[php]Private Sub TextBoxProcess_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBoxProcess.TextChanged
If Autoinject.Checked AndAlso tmrAutoInject.Enabled = False Then
tmrAutoInject.Start()
End If
End Sub

Private Sub Autoinject_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Autoinject.CheckedChanged
If Autoinject.Checked Then
tmrAutoInject.Enabled = True
tmrAutoInject.Interval = 100
tmrAutoInject.Start()
Else
tmrAutoInject.Stop()
tmrAutoInject.Enabled = False
End If
End Sub

Private Sub tmrAutoInject_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrAutoInject.Tick
Try
TextBoxProcess.Text = TextBoxProcess.Text.Replace(".exe", "")
Dim validProc As Boolean = Process.GetProcessesByName(TextBoxProcess.Text).Ge tUpperBound(0) + 1
If validProc Then
tmrAutoInject.Stop()
Call inject()
tmrAutoInject.Enabled = False
If closebox.Checked = True Then
Me.Close()
End If
End If
Catch ex As Exception
MsgBox("An unknown error has occured", MsgBoxStyle.Exclamation, "Warning!")
End Try
End Sub
[/php]

Why not putting that code in the inject() sub?
[php] If closebox.Checked = True Then
Me.Close()
End If[/php]
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us