Microsoft Visual Basic(whats wrong with this??)
Code:
Private Sub Hotkey_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkey.Tick
Dim Hotkey As Boolean
Hotkey = GetAsyncKeyState(Keys.F)
If Hotkey = True Then
SendKeys.Send(3)
SendKeys.Send(0)
End If
End Sub
End Class
everytime i do this i get the error PInvokeStackImbalance.
Anyone know what I did wrong??

Use this instead:
SendKeys.Send("3")
SendKeys.Send("0")
/Moved to VB
What is your timer interval at? Set it to 1.
Try defining the hotkey as global. Sometimes it helps.
EDIT: You did start the timer didn't you?
Change your GetAsyncKeyState declaration to this
[php]
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vkey As Long) As UShort
[/php]
And your code to this (not much changed, but for the sake of a control, here:
[php]
Private Sub Hotkey_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkey.Tick
Dim Hotkey As Boolean = GetAsyncKeyState(Keys.F)
If Hotkey = True Then
SendKeys.Send("3")
SendKeys.Send("0")
End If
End Sub
[/php]
Let me know if that helps.
Are you trying to make it work in-game? If so then it won't work.
If you still get the error, please take a printscreen and post it here.
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vkey As int16) As int32
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
Dim Hotkey As Boolean
Hotkey = GetAsyncKeyState(Keys.3)
Pleasure, it is x64 bit related :]
My code will work on both, x64/x32.
Now, how do it get it to work ingame :I