Hi, i'd tried to use my mouse event to control the game, however i get the error shown below:
Sub or function not defined (debug shows error at BtnOK_Click)
My declaration:
CODE
Dim Position As POINTAPI
Dim Mystring As String
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim PosX As Long
Dim PosY As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Below will be my code of implementation:
CODE
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 115 Or KeyAscii = 83 Then
cmddown_Click
End If
If KeyAscii = 97 Or KeyAscii = 65 Then
cmdleft_Click
End If
If KeyAscii = 100 Or KeyAscii = 68 Then
cmdright_Click
End If
If KeyAscii = 119 Or KeyAscii = 87 Then
cmdup_Click
End If
If KeyAscii = 44 Then
leftClick_click
End If
If KeyAscii = 46 Then
rightClick_click
End If
If KeyAscii = 108 Then
middleClick_click
End If
If KeyAscii = 13 Then
BtnOK_Click
End If
If KeyAscii = 101 Or KeyAscii = 69 Then
cmdClose
End If
If KeyAscii = 114 Or KeyAscii = 82 Then
cmdReset
End If
End Sub