Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 19:45

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

Advertisement



help me with mouseclick drag while minimized

Discussion on help me with mouseclick drag while minimized within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
sutansah's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 118
Received Thanks: 48
help me with mouseclick drag while minimized

anyone know about mouseclick drag minimized?....

this my script about mouseclick and mousewheel while minimized...

Code:
Func _MouseClick($Window, $BUTTON, $x, $y, $CLICKS = 1, $delay = 15)
	Local $MK_LBUTTON = 0x0001
	Local $WM_LBUTTONDOWN = 0x0201
	Local $WM_LBUTTONUP = 0x0202
	Local $MK_RBUTTON = 0x0002
	Local $WM_RBUTTONDOWN = 0x0204
	Local $WM_RBUTTONUP = 0x205
	Local $WM_MOUSEMOVE = 0x200
	Local $i = 0
	Local $BUTTONDOWN = $WM_LBUTTONDOWN
	Local $BUTTONUP = $WM_LBUTTONUP
	$button = StringLower($button)
	local $MOUSECOORD = MouseGetPos()
	$X = $MOUSECOORD[0]
	$Y = $MOUSECOORD[1]
	
	Local $user32 = DllOpen("user32.dll")
		
	If $button = "left" Then
	For $i = 1 To $CLICKS
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_MOUSEMOVE, "int", 0, "long", _MAKELONG($X, $Y))
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_LBUTTONDOWN, "int", $MK_LBUTTON, "long", _MAKELONG($X, $Y))
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_LBUTTONUP, "int", 0, "long", _MAKELONG($X, $Y))
		
		If $i < $CLICKS Then Sleep($delay)
	Next
	ElseIf $button = "right" Then
		For $i = 1 To $CLICKS
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_MOUSEMOVE, "int", 0, "long", _MAKELONG($X, $Y))
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_RBUTTONDOWN, "int", $MK_RBUTTON, "long", _MAKELONG($X, $Y))
		DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_RBUTTONUP, "int", 0, "long", _MAKELONG($X, $Y))
		
		If $i < $CLICKS Then Sleep($delay)
	Next
	Else
		SetError(-2)
		If $user32 <> -1 Then DllClose($user32)
		Return
	    EndIf
	
	If $user32 <> -1 Then DllClose($user32)
EndFunc

Func _MouseWheel($Window, $direction , $clicks)
    Local $WM_MOUSEWHEEL  =  0x020A
    local $MouseCoord = MouseGetPos()
	local $X = $MouseCoord[0]
	local $Y = $MouseCoord[1]
	Local $user32 = DllOpen("user32.dll")
	
    If $direction = "up" then
	local $WheelDelta = 120
    Else
    local $WheelDelta = -120
    Endif
    For $i = 0 to $clicks
    DllCall($user32, "int", "SendMessage", "hwnd",  WinGetHandle( $Window ), "int",  $WM_MOUSEWHEEL, "long", _MakeLong(0,$WheelDelta), "long",  _MakeLong($X, $Y))
    Next
EndFunc

Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
thats my script about mouseclick and mousewheel while minimized

but when im make mousedrag while minimizd...it didnt work...this my script about mousedrag..
Code:
Func _MouseDrag($Window, $Button,  $x, $y, $xTo, $yTo, $Delay = 15)
	Local $MK_LBUTTON = 0x0001
	Local $WM_LBUTTONDOWN = 0x0201
	Local $WM_LBUTTONUP = 0x0202

	Local $MK_RBUTTON = 0x0002
	Local $WM_RBUTTONDOWN = 0x0204
	Local $WM_RBUTTONUP = 0x0205

	Local $WM_MOUSEMOVE = 0x0200
	Local $BUTTONDOWN = $WM_LBUTTONDOWN
	Local $BUTTONUP = $WM_LBUTTONUP
	$button = StringLower($button)
	local $MouseCoord = MouseGetPos()
	$X = $MouseCoord[0]
	$Y = $MouseCoord[1]
	$xTo = $MouseCoord[0]
	$yTo = $MouseCoord[1]
	
	Local $user32 = DllOpen("user32.dll")
	
	   
   If $button = "left" Then
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($X, $Y))
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_LBUTTONDOWN, "int", $MK_LBUTTON, "long", _MakeLong($X, $Y))
	sleep($delay)
	
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($xTo, $yTo))
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_LBUTTONUP, "int", 0, "long", _MakeLong($xTo, $yTo))
	sleep($delay)
	
    ElseIf $button = "right" Then
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($X, $Y))
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_RBUTTONDOWN, "int", $MK_RBUTTON, "long", _MakeLong($X, $Y))
	sleep($delay)
	
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($xTo, $yTo))
	DllCall($user32, "int", "SendMessage", "hwnd", WinGetHandle( $Window ), "int", $WM_RBUTTONUP, "int", 0, "long", _MakeLong($xTo, $yTo))
	sleep($delay)
	Else
		SetError(-2)
		If $user32 <> -1 Then DllClose($user32)
		Return
	EndIf
	If $user32 <> -1 Then DllClose($user32)
EndFunc
Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
anyone knows about what wrong in that mousedrag script please tell me...
sutansah is offline  
Old 03/21/2012, 18:23   #2
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
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
KDeluxe is offline  
Old 03/21/2012, 19:04   #3
 
sutansah's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 118
Received Thanks: 48
Quote:
Originally Posted by KDeluxe View Post
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
owh thanks kdeluxe....for func makelong its same with mine or not?....
Code:
Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
and for func mouse move...do u know the script?....i wanna make script like move cursor in game if that cursor like sword cursor it will mouseclick left(attack)...
sutansah is offline  
Old 03/21/2012, 23:52   #4
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
Code:
Func _MakeLong($LowWORD, $HiWORD)
    Return BitOR($HiWORD * 0x10000, BitAND($LowWORD, 0xFFFF))
EndFunc
or

Code:
Func _MakeLong($LowWORD, $HiWORD)
	Return BitOR(BitShift($HiWORD, -16), BitAND($LowWORD, 0xFFFF))
EndFunc
The WM_MOUSEMOVE message won't change your cursor icon. Try to select something with the Tabulator-Key and attack it with some skills.
KDeluxe is offline  
Old 12/01/2012, 07:36   #5
 
elite*gold: 0
Join Date: Dec 2012
Posts: 2
Received Thanks: 0
@KDeluxe: Hi there. I use your UDF and save in ClickDrag.au3. Here is my script:

#include <ClickDrag.au3>
$hWnd='VNC Viewer'
_PostMessage_ClickDrag($hWnd, 43, 284, 245, 286, "right", 1000)
MsgBox(0,'',@error)

@error = 0 but anything happens when I run this script. Could you please tell me what wrong in my script? Thank you so much!
bun_lope is offline  
Old 12/03/2012, 16:49   #6
 
elite*gold: 0
Join Date: Dec 2012
Posts: 2
Received Thanks: 0
Somebody helps me please
bun_lope is offline  
Old 10/29/2016, 11:33   #7
 
elite*gold: 0
Join Date: Jan 2012
Posts: 37
Received Thanks: 2
Quote:
Originally Posted by bun_lope View Post
@KDeluxe: Hi there. I use your UDF and save in ClickDrag.au3. Here is my script:

#include <ClickDrag.au3>
$hWnd='VNC Viewer'
_PostMessage_ClickDrag($hWnd, 43, 284, 245, 286, "right", 1000)
MsgBox(0,'',@error)

@error = 0 but anything happens when I run this script. Could you please tell me what wrong in my script? Thank you so much!
I have the same problem, can anyone help please?
SaidJan is offline  
Reply


Similar Threads Similar Threads
EDIT und Drag and Drop
04/11/2010 - AutoIt - 3 Replies
Hi, ich wollte fragen wie man einen GuiCtrlCreateEdit so macht, dass man eine Datei reinziehen kann und er dann im Edit den Namen der Datei zeigt. Ich hab bei den Styles und EXStyles geguckt, aber nix gefunden.
D3D Menu -> Drag
02/13/2010 - General Coding - 0 Replies
Moin. Welche Möglichkeiten gibt es ein D3D Menu per Drag & Drop zu bewegen? Mit Mouseover hab ich's probiert, da gibt's iwie Probleme mit den Koordinaten wegen der Fenstertitelleiste (War mit GetCursorPos & ScreenToClient). Für die Sache mit dem Windowhook mywndProc_Old = (WNDPROC)SetWindowLongPtr( hWnd, GWL_WNDPROC, (LONG)(LONG_PTR)newWndProc ); Bin ich anscheinend auch zu dumm :rolleyes:
[Help] Mob Drag Limit
11/15/2009 - Dekaron Private Server - 2 Replies
Does anyone know where to set this? ive looked in maplist and monster.csv and I don't see anything that catches my eye on where to set it.
drag more than 3 mob
01/01/2008 - Dekaron - 15 Replies
do anyone know how u can drag more than 3 monster at a time..



All times are GMT +2. The time now is 19:45.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.