Jump to content

Keikopute

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Keikopute

  1. Just a quick reply... I was able to made it by sending PostMessage instead of SendMessage. Regards, Keikopute
  2. Yes exactly, it's supposed to click it because of those 2 messages : _SendMessage($hwnd, $WM_LBUTTONDOWN, 1, _WinAPI_MakeLong($x1, $y1)) _SendMessage($hwnd, $WM_LBUTTONUP, 0, _WinAPI_MakeLong($x1, $y1))But it doesn't and I don't understand why. Do you have any idea ?
  3. Hello, Can anyone help me please ? :-)
  4. No, it's for interfacing with Cinderella software : http://www.cinderella.dk/csdl.html which is detected as a "SDL_App" by AutoIt Window Info Tool thus ControlClick doesn't work on client area.
  5. The (x,y) position I am sending are, accordingly to AutoIt Window Info, the position of the "test" button. That is why I think it should be working. I tried ControlClick and it worked fine, but I specifically want to use SendMessage because I will need to send a click to a SDL window.
  6. Yes, it's because I want to keep it simple for now. Making it work in the active window, then I could do the same for an "inactive" window.
  7. Hello all, I know this topic has already been discussed multiple times but I can't figure out what is wrong with my code. I would like to send a mouse click to a window without focus. The following piece of code is creating a GUI with a "test" button. Clicking on the "test" button print a "ok" to the console. When pressing the keys CTRL + P, the VirtualMouseClick() function is called. This function calls the following : _SendMessage($hwnd, $WM_LBUTTONDOWN, 1, _WinAPI_MakeLong($x1, $y1)) _SendMessage($hwnd, $WM_LBUTTONUP, 0, _WinAPI_MakeLong($x1, $y1))Which should do what I want.. but it doesn't. Could you help me with it please ? Thank you Here is the code: #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ;~ Opt("MustDeclareVars", 1) HotKeySet("^p", VirtualMouseClick) Global $gui Global $size[2] = [300, 300] $gui = GUICreate("", $size[0], $size[1]) GUISetOnEvent($GUI_EVENT_CLOSE, "quit", $gui) GUICtrlCreateButton("Test", 10, 10, 100, 80) GUICtrlSetOnEvent(-1, "TestOk") GUISetState(@SW_SHOW, $gui) ConsoleWrite($gui & @CRLF) While(True) Sleep(200) WEnd Func _ArrayFind($array, $item) Local $retour = False For $i = 0 To UBound($array) -1 If($array[$i] = $item) Then $retour = True ExitLoop EndIf Next Return $retour EndFunc Func quit() Exit EndFunc Func TestOk() ConsoleWrite("ok" & @CRLF) EndFunc Func VirtualMouseClick() Sleep(100) Local $hwnd = WinGetHandle("[ACTIVE]") Local $x1 = 30 Local $y1 = 50 Local $isDown = 1 ConsoleWrite("$hwnd = " & $hwnd & @LF) ;~ _SendMessage($hwnd, $WM_MOUSEMOVE, 0, _WinAPI_MakeLong($x1, $y1)) ;~ Sleep(50) _SendMessage($hwnd, $WM_LBUTTONDOWN, 1, _WinAPI_MakeLong($x1, $y1)) ;~ Sleep(50) ;~ _SendMessage($hwnd, $WM_MOUSEMOVE, 1, _WinAPI_MakeLong($x1, $y1)) Sleep(50) _SendMessage($hwnd, $WM_LBUTTONUP, 0, _WinAPI_MakeLong($x1, $y1)) EndFunc
×
×
  • Create New...