Vindicator Posted October 29, 2006 Posted October 29, 2006 How do I make WinMove move a window slowly instead of instantly, as if someone is dragging the window? My script so far: #include <GuiConstants.au3> #include <misc.au3> GuiCreate("MyGUI", 115, 165,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER)) $Pic_1 = GuiCtrlCreatePic("template.gif", 0, 0, 120, 170) GuiSetState() Func _ClickWait() While (_IsPressed('01') == 0) sleep(10) WEnd $y=MouseGetPos(1) $x=MouseGetPos(0) WinMove("MyGUI","",$x,$y);<=== This Part WinSetOnTop("MyGUI","",1) EndFunc While 1 _ClickWait() WEnd I wanted the appearance that the window folows the mouse click... If I hadn't said thank you yet, and you deserve it, than thank you...
cppman Posted October 29, 2006 Posted October 29, 2006 It does... you have to hold down the mouse.. Did you want the clicking of the mouse to toggle the following? Miva OS Project
Vindicator Posted October 29, 2006 Author Posted October 29, 2006 (edited) yeas so like if I click one place, it would move there as if some invisibly mouse dragged it to that point because whit that code, it instantly reappears that the clicked location... I was thinking maybe it would slowly move to that point... I was thinking of a while loop that moves it one pixel at a time but uhhh... Im sure there must be a simpler way? Edited October 29, 2006 by P a R a D o X If I hadn't said thank you yet, and you deserve it, than thank you...
Paulie Posted October 29, 2006 Posted October 29, 2006 (edited) yeasso like if I click one place, it would move there as if some invisibly mouse dragged it to that pointbecause whit that code, it instantly reappears that the clicked location... I was thinking maybe it would slowly move to that point... I was thinking of a while loop that moves it one pixel at a time but uhhh... Im sure there must be a simpler way?Look at For...Next Loops in the helpfile. Edited October 29, 2006 by Paulie
cppman Posted October 29, 2006 Posted October 29, 2006 (edited) is this what you wanted?? This is a little glitchy, and slow... but you could try something like this expandcollapse popup#include <GuiConstants.au3> #include <misc.au3> $hWnd = GuiCreate("MyGUI", 115, 165,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_BORDER)) $Pic_1 = GuiCtrlCreatePic("template.gif", 0, 0, 120, 170) GuiSetState() Func _ClickWait() While (_IsPressed('01') == 0) sleep(10) WEnd EndFunc While 1 _ClickWait() $ss = WInGetPos($hWnd) $sp = MouseGetPos() _WinMoveTo($hWnd, $ss[0], $ss[1], $sp[0], $sp[1]) WEnd Func _WinMoveTo($hWnd, $a, $b, $c, $d) Local $u, $s, $v, $d1x, $d1y, $d2x, $d2y, $m, $n Local $i $u = $c-$a $v = $d-$b $d1x = sgn($u) $d1y = sgn($v) $d2x = sgn($u) $d2y = 0 $m = abs($u) $n = abs($v) if ($m <= $n) Then $d2x = sgn($v) $d2y = abs($v) $n = abs($u) EndIf $s = $m/2 Local $x = $a, $y = $b for $i = 0 to round($m) WinMove($hWnd, "", $x, $y) $s += $n if ($s >= $m) Then $s -= $m $x += $d1x $y += $d1y Else $x += $d2x $y += $d2y EndIf Next EndFunc Func SGN($a) if ($a>0) then return 1 if ($a<0) then return -1 return 0 EndFunc Edited October 29, 2006 by CHRIS95219 Miva OS Project
Vindicator Posted October 30, 2006 Author Posted October 30, 2006 Wow, with a little add in of WinSetOnTop, that works like a charm, but I'm still trying to understand what you did, but hey, thanks, I would imagine that took you some time... thanks again If I hadn't said thank you yet, and you deserve it, than thank you...
cppman Posted October 30, 2006 Posted October 30, 2006 Wow, with a little add in of WinSetOnTop, that works like a charm, but I'm still trying to understand what you did, but hey, thanks, I would imagine that took you some time... thanks againlol, np... Just a little research for line algorithms...anyways, i added a function that gets the coordinates to draw a straight line to the mouse coordinates _WinMoveTo($window_handel, $x_start, $y_start, $x_end, $y_end) Miva OS Project
Vindicator Posted October 30, 2006 Author Posted October 30, 2006 interesting... If I hadn't said thank you yet, and you deserve it, than thank you...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now