Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 15:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Control MouseClickDrag

Discussion on Control MouseClickDrag within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
D2_sid's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 329
Received Thanks: 91
Control MouseClickDrag

Ich habe hier einen alten Beitrag gefunden mit einer UDF, mit der ein Mouse Drag an einen bestimmten Client gesendet wird.

Code:
;=================================================================================================
; Function:			_PostMessage_ClickDrag($hWnd, $X1, $Y1, $X2, $Y2, $Button = "left")
; Description:		Sends a mouse click and drag command to a specified window.
; Parameter(s):		$hWnd - The handle or the title of the window.
;					$X1, $Y1 - The x/y position to start the drag operation from.
;					$X2, $Y2 - The x/y position to end the drag operation at.
;					$Button - (optional) The button to click, "left", "right", "middle". Default is the left button.
;					$Delay - (optional) Delay in milliseconds. Default is 50.
; Requirement(s):	A window handle/title.
; Return Value(s):	On Success - Returns true
;					On Failure - Returns false
;					@Error - 0 = No error.
;							 1 = Invalid window handle or title.
;							 2 = Invalid start position.
;							 3 = Invalid end position.
;							 4 = Failed to open the dll.
;							 5 = Failed to send a MouseDown command.
;							 5 = Failed to send a MouseMove command.
;							 7 = Failed to send a MouseUp command.
; Author(s):		KillerDeluxe
;=================================================================================================
Func _PostMessage_ClickDrag($hWnd, $X1, $Y1, $X2, $Y2, $Button = "left", $Delay = 50)
	If Not IsHWnd($hWnd) And $hWnd <> "" Then
		$hWnd = WinGetHandle($hWnd)
	EndIf

	If Not IsHWnd($hWnd) Then
		Return SetError(1, "", False)
	EndIf

	If Not IsInt($X1) Or Not IsInt($Y1) Then
		Return SetError(2, "", False)
	EndIf

	If Not IsInt($X2) Or Not IsInt($Y2) Then
		Return SetError(3, "", False)
	EndIf

	If StringLower($Button) == "left" Then
		$Button = $WM_LBUTTONDOWN
		$Pressed = 1
	ElseIf StringLower($Button) == "right" Then
		$Button = $WM_RBUTTONDOWN
		$Pressed = 2
	ElseIf StringLower($Button) == "middle" Then
		$Button = $WM_MBUTTONDOWN
		$Pressed = 10
		If $Delay == 10 Then $Delay = 100
	EndIf

	$User32 = DllOpen("User32.dll")
	If @error Then Return SetError(4, "", False)

	DllCall($User32, "bool", "PostMessage", "hwnd", $hWnd, "int", $Button, "int", "0", "long", _MakeLong($X1, $Y1))
	If @error Then Return SetError(5, "", False)

	Sleep($Delay / 2)

	DllCall($User32, "bool", "PostMessage", "hwnd", $hWnd, "int", $WM_MOUSEMOVE, "int", $Pressed, "long", _MakeLong($X2, $Y2))
	If @error Then Return SetError(6, "", False)

	Sleep($Delay / 2)

	DllCall($User32, "bool", "PostMessage", "hwnd", $hWnd, "int", $Button + 1, "int", "0", "long", _MakeLong($X2, $Y2))
	If @error Then Return SetError(7, "", False)

	DllClose($User32)
	Return SetError(0, 0, True)
EndFunc
Ich habe diesen Code in einer neue ClickDrag.au3 kopiert und in den Ordner include eingefügt.

In meinem Script:
Code:
#include <ClickDrag.au3>
#include <SendMessage.au3>

$HANDLE = WinGetHandle ( "Example" )

Func _Test()
 While 1
   _PostMessage_ClickDrag($HANDLE, $z1, $z2, $z1+80, $z2, "right")
   Sleep(200)
 WEnd
EndFunc
Es passiert leider gar nichts. Hat jemand eine Idee?
D2_sid is offline  
Old 06/08/2015, 13:29   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Was soll denn da auch passieren? Die Funktionen sind in einer Funktion versteckt die gar nicht gecallt wird.
alpines is offline  
Old 06/08/2015, 13:48   #3
 
D2_sid's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 329
Received Thanks: 91
Dann verstehe ich da wohl etwas grundlegend falsch. Ist es denn mit dieser UDF möglich ein Control Mouse Drag an ein inaktives Fenster zu senden?
D2_sid is offline  
Old 06/08/2015, 17:50   #4
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Where is supposed to be the function _MakeLong($x1,$x2) in your click drag UDF ?, i searched in my SendMessage.au3 file and that function does not exist. Then won't work until u define that function.
elmarcia is offline  
Old 06/08/2015, 17:51   #5
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Quote:
Originally Posted by D2_sid View Post
Dann verstehe ich da wohl etwas grundlegend falsch. Ist es denn mit dieser UDF möglich ein Control Mouse Drag an ein inaktives Fenster zu senden?
In deinem Script wird die Drag-Funktion in einer anderen Funktion verwendet die nie gecalled wird -> Drag-Funktion wird auch nie gecalled. Beschäftige dich doch mal mit den Grundlagen bevor du sowas machen willst.
alpines is offline  
Old 06/15/2015, 20:08   #6
 
elite*gold: 0
Join Date: Feb 2015
Posts: 1
Received Thanks: 0
Quote:
Originally Posted by D2_sid View Post
In meinem Script:
Code:
#include <ClickDrag.au3>
#include <SendMessage.au3>

$HANDLE = WinGetHandle ( "Example" )

Func _Test()
 While 1
   _PostMessage_ClickDrag($HANDLE, $z1, $z2, $z1+80, $z2, "right")
   Sleep(200)
 WEnd
EndFunc
ändere es in

Code:
#include <ClickDrag.au3>
#include <SendMessage.au3>

$HANDLE = WinGetHandle ( "Example" )
_Test($HANDLE)
Exit

Func _Test($HANDLE)
 While 1
   _PostMessage_ClickDrag($HANDLE, $z1, $z2, $z1+80, $z2, "right")
   Sleep(200)
 WEnd
EndFunc
Dann wird Deine Func aufgerufen, das ist auch die Aussage von alpines

urlau is offline  
Reply


Similar Threads Similar Threads
MSI Control Center Mobile Control
01/21/2014 - Technical Support - 2 Replies
Heyhoo! Ich habe gesehen das mein MSI Control Center ein Mobile Control hat. Habs auch direkt ausprobiert. App auf meinem Handy installiert und dann die Daten eingegeben. Allerdings kriege ich jedesmal zu hören das die Verbindung instabil sei. Allerdings ist die Verbindung perfekt. Warum will das nicht so wie ich will? o.o
[Q]MouseclickDrag ohne Fokus?
10/29/2012 - AutoIt - 5 Replies
Hallo, ich soll für jemanden ein AutoIt-Script erstellen, dass er auch nebenbei laufen lassen kann, ohne beim Surfen oder ähnlichem eingeschränkt zu sein. Das Script funktioniert soweit einwandfrei wenn das entsprechende Fenster fokusiert ist, aber sobald es das nichtmehr ist, zickt die Funktion MouseclickDrag rum. Da ich nicht so der AutoIt-Held bin, hab ich erstmal ausführlich gegoogelt, aber zu einer Lösung hat das nicht geführt. :mad: Weiß da evtl. jemand von euch einen Rat? mfg
[1.9.433] Server Control Hack. (Control every players life in your room !!)
08/21/2012 - Call of Duty Hacks, Bots, Cheats & Exploits - 46 Replies
Features: -Force Host -Change Max Players in lobby -Activate / De-Activate Godmode for every player in the room (Lets you survive anything, EVEN enemy MOAB's !) -Give unlimited ammo / Take ALL Ammo of every player in the room (Take all their ammo, leaving them nothing but a knife !) How To:
[Question]MouseClickDrag...
11/10/2010 - AutoIt - 1 Replies
Hi leute ich hab pc verbot und deshalb nicht so viel zeit.. Also meine Frage ich bracuche ein script das die maus über 3 stationen zieht und die linke maustaste gedrückt bleibt also ich habs schonmal versucht aber ich hab nur das und das geht nur über 2 stationen: HotKeySet("{s}", "_start") HotKeySet("{ESC}", "_exit") Func _start() MouseClickDrag("left",207,632,{16,739}, 1279,101,1) ;das in den klammern {} sind die fehlenden xy-werte EndFunc Func _exit()
Control Center for Admin Easy to Control all
10/16/2009 - MapleStory - 2 Replies
Credits go to ucyc for making this nice programm http://www.pictureupload.de/originals/pictures/15 1009164127_2.jpg http://www.pictureupload.de/originals/pictures/15 1009164303_3.jpg Download Click here



All times are GMT +1. The time now is 15:29.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.