Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,210 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 912 people online right now. Registration is fast and FREE... Join Now!




mouse event

 
Reply to this topicStart new topic

mouse event

evios
post 31 Mar, 2008 - 09:47 PM
Post #1


New D.I.C Head

*
Joined: 29 Mar, 2008
Posts: 2

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


User is offlineProfile CardPM

Go to the top of the page

born2c0de
post 1 Apr, 2008 - 04:23 AM
Post #2


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,905



Thanked 34 times

Dream Kudos: 2800

Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions


QUOTE
Sub or function not defined (debug shows error at BtnOK_Click)

This means that you haven't defined the BtnOK_Click() Procedure anywhere in the code.

Check for typos in the function's name if you're certain that you've added your function.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 07:49PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month