Sending mouse click signals
-
Hi does someone know how to send a mouse click signal I want to send a code that the mouse sends the left click and holds it do you know how to make it?
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const BM_CLICK = &HF5 Dim x As Long, staticx As Long, MyStr As String, y As String, control As Long x = FindWindow("#32770", vbNullString) 'x = FindWindow(vbNullString, "Project") ' get handle to Ok button control = FindWindowEx(x, 0, "Button", "Ok") ' click the button SendMessage control, BM_CLICK, 0, 0 SendMessage control, BM_CLICK, 0, 0 End Sub That's how you click a button on a msgbox - in this case "ok". I imagine it will be reasonably similar but not sure about the holding it, you could try putting the SendMessage Control in a loop.. The #32770 is the msgbox class, to send a message to a different window use the commented out bit and put the name of the window you wish to send the message to in place of "Project" Sound!!!!!! Hope you can work with that "If i was king cigarettes would be free."