Hi, I'm trying to make an app for another application using GetAsyncKeyState.
I coded what I thought to be good and clicked "Build". When I opened it, I tested it in notepad. When I hit NumPad2, it should return
orCode:`camera_control 0
Instead, it returns:Code:`camera_control 1
orCode:`camera_control 0`camera_control 1`camera_control 0`camera_control 1`camera_control 0
This is my code:Code:`camera_control 1`camera_control 0`camera_control 1`camera_control 0`camera_control 1
How would I make it return as it should?Code:Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public camcont As Boolean = False
Public curplayer As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Timer1.Enabled = True Then
Timer1.Interval = 1
If GetAsyncKeyState(Keys.NumPad2) Then
If camcont = False Then
SendKeys.Send("`")
SendKeys.Send("camera_control 1")
camcont = True
Else
SendKeys.Send("`")
SendKeys.Send("camera_control 0")
camcont = False
End If
End If
If GetAsyncKeyState(Keys.NumPad1) Then
If camcont = True Then
curplayer = curplayer + 1
SendKeys.Send("`")
SendKeys.Send("if (unit (list_get (players) " & curplayer & ")) (camera_set_first_person (unit (list_get (players) " & curplayer & ")))")
'SendKeys.Send("camera_set_first_person (unit (list_get (players) " & curplayer & "))")
End If
End If
If GetAsyncKeyState(Keys.NumPad3) Then
If camcont = True Then
curplayer = curplayer - 1
SendKeys.Send("`")
SendKeys.Send("if (unit (list_get (players) " & curplayer & ")) (camera_set_first_person (unit (list_get (players) " & curplayer & ")))")
'SendKeys.Send("camera_set_first_person (unit (list_get (players) " & curplayer & "))")
End If
End If
End If
End Sub
I am using VS 2010 with .NET framework 4.0 Beta 1.
Thanks for any help,
-Arightwizard