I wanted to make some sort of macro for mouse events en keyboard events,
but the mousedown event doesn't work,
Although the position of the mouse works perfectly!
Can someone guide me to the solution?Code: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) Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long Private Const CF_TEXT = 1 Const MOUSEEVENTF_LEFTDOWN = &H2 Const MOUSEEVENTF_LEFTUP = &H4 Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up Const MOUSEEVENTF_MOVE = &H1 ' mouse move Const WM_CHAR = &H102 Sub dodo() SetCursorPos 85, 220 mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0 'mouse_event MOUSEEVENTF_RIGHTUP, 0&, 0&, cButt,dwEI 'mouse_event MOUSEEVENTF_RIGHTDOWN, 0&, 0&, cButt, dwEI mouse_event MOUSEEVENTF_MOVE, 150, 130, 0, 0 mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 DoEvents End Sub




Reply With Quote