Jump to content

Is there some way (API maybe?) to send message to GUI-window for "magnetic effect"?


Recommended Posts

Posted

Hi,

I am wondering, is there a message or something to tell to window that it must be attchached to the screen edges?

I mean, there is some application that have this feature - you drag the window near the edges of the screen, and the window is like magnet attached to the edges (from all sides)..

I did it in "custom way" here, but it's not it...

I would like that the window will be attched while i am draging it, and will not go back when i release the mouse button - this behaviour i can make using GUIRegisterMsg(0x0046, "WM_WINDOWPOSCHANGING"), but the problem is that when i release the mouse button, window go back (to initial mouse position), and also while i am draging the window it always moving rapidly, witch is not so nice effect.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

Personally I'd try to work with WM_MOVING instead of WM_WINDOWPOSCHANGING. This would probably solve your "window moves back when mouse released" problem.

Edited by Siao

"be smart, drink your wine"

Posted

Thanks guys..

i have found some interesting stuff by those links that you provided smashly, but it seems that all these not mutch helping in my problem.. this is what basicaly i need - http://delphi.about.com/od/formsdialogs/l/aa070301a.htm, but not on delphi, on AutoIt :) - Is it possible?

  Quote

Personally I'd try to work with WM_MOVING instead of WM_WINDOWPOSCHANGING. This would probably solve your "window moves back when mouse released" problem.

Nope, i have tryed this at the begining, thanks.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

  MsCreatoR said:

Nope, i have tryed this at the begining, thanks.

You'd probably need to modify the RECT structure ($lParam of WM_Moving function points to it), like

$rect = DllStructCreate("long left; long top; long right; long bottom", $lParam)

and then DllStructGetData and DllStructSetData.

Edited by Siao

"be smart, drink your wine"

Posted

Thanks Siao, but my self and Dll functions are no going together yet ;)...

And eventualy the WM_MOVE did work for me, thanks and sorry for disinformation.

Here is what i came up with at the end(?), witch is no so accurate in some cases...

Global Const $WM_MOVE   = 0x0003

Global $AttachRange     = 30
Global $Delay           = 1

$HwndGui = GUICreate("Attach Window GUI to screen edges")

GUIRegisterMsg($WM_MOVE, "WM_MOVE")

GUICtrlCreateLabel("Drag me to the edges of your screen ;) ", 50, 50, 350)
GUICtrlSetFont(-1, 14)

GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _WinDock($hWnd, $AttachRange=20, $Delay=10)
    Local $OldOpt = Opt("WinTitleMatchMode", 4)
    Local $WinPosArr = WinGetPos($hWnd)
    Local $WidthHeightArr = WinGetClientSize($hWnd)
    If IsArray($WinPosArr) And IsArray($WidthHeightArr) Then
        Local $xDestPos, $yDestPos
        
        Local $MousePos = MouseGetPos()
        Local $xPos = $WinPosArr[0] 
        Local $yPos = $WinPosArr[1]
        Local $Width = $WidthHeightArr[0]
        Local $Height = $WinPosArr[3]
        Local $TrayPosHeight = WinGetPos("classname=Shell_TrayWnd")
        If IsArray($TrayPosHeight) Then $TrayPosHeight = $TrayPosHeight[3]
        
        If $xPos >= (@DesktopWidth-($Width+$AttachRange)) And ($xPos+$Width-15) < (@DesktopWidth-22) And _
            StringInStr(MouseMoveDirection(), "Right") Then
            $xDestPos = @DesktopWidth-$Width
            
            For $i = $xPos To $xDestPos Step 8
                MouseMove(($MousePos[0]+($i-$xPos)), $MousePos[1], 0)
                WinMove($hWnd, "", $i, $yPos)
                Sleep($Delay)
            Next
        EndIf
        
        If $xPos <= $AttachRange And $xPos > 8 And StringInStr(MouseMoveDirection(), "Left") Then
            $xDestPos = -4
            
            For $i = $xPos To $xDestPos Step -8
                MouseMove(($MousePos[0]+($i-$xPos)), $MousePos[1], 0)
                WinMove($hWnd, "", $i, $yPos)
                Sleep($Delay)
            Next
        EndIf
        
        If $yPos >= (@DesktopHeight-($TrayPosHeight+$Height+$AttachRange)) And _
            ($TrayPosHeight+$yPos+$Height-15) < (@DesktopHeight-22) And StringInStr(MouseMoveDirection(), "Down") Then
            $yDestPos = @DesktopHeight-$Height-$TrayPosHeight+4
            
            For $i = $yPos To $yDestPos Step 8
                MouseMove($MousePos[0], ($MousePos[1]+($i-$yPos)), 0)
                WinMove($hWnd, "", $xPos, $i)
                Sleep($Delay)
            Next
        EndIf
        
        If $yPos <= $AttachRange And $yPos > 8 And StringInStr(MouseMoveDirection(), "Up") Then
            Local $yDestPos = -4
            
            For $i = $yPos To $yDestPos Step -8
                MouseMove($MousePos[0], ($MousePos[1]+($i-$yPos)), 0)
                WinMove($hWnd, "", $xPos, $i)
                Sleep($Delay)
            Next
        EndIf
    EndIf
    Opt("WinTitleMatchMode", $OldOpt)
EndFunc

Func WM_MOVE($hWnd, $MsgID, $WParam, $LParam)
    _WinDock($HwndGui, $AttachRange, $Delay)
EndFunc

Func MouseMoveDirection()
    Local $MousePosArr = MouseGetPos(), $RetDirection = ""
    Local $StartXPos = $MousePosArr[0]
    Local $StartYPos = $MousePosArr[1]
    
    Sleep(50)
    
    $MousePosArr = MouseGetPos()
    
    Local $EndXPos = $MousePosArr[0]
    Local $EndYPos = $MousePosArr[1]
    
    If $StartXPos < $EndXPos Then
        $RetDirection = "Right"
    ElseIf $StartXPos > $EndXPos Then
        $RetDirection = "Left"
    EndIf
    
    If $StartYPos < $EndYPos Then
        $RetDirection &= "Down"
    ElseIf $StartYPos > $EndYPos Then
        $RetDirection &= "Up"
    EndIf
    Return $RetDirection
EndFunc

If someone can make it via Dll...xxx function in that way that it will attached just like other apps do, it will be greate, because i realy do not know how to manage this stuff... (yet?) :) .

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

Here's a quick demo of what I was talking about

#include <GUIConstants.au3>

Const $Range = 100
Const $WM_MOVING = 0x0216
Const $WM_ENTERSIZEMOVE = 0x0231
Global $taskbarPos = WinGetPos("[CLASS:Shell_TrayWnd]"), $x_start, $y_start

$gui = GUICreate("Attach Window GUI to screen edge", 350, 200)
GUISetState()
GUIRegisterMsg($WM_ENTERSIZEMOVE, "On_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_MOVING, "On_WM_MOVING")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func On_WM_ENTERSIZEMOVE()
    $aMPos = MouseGetPos()
    $x_start = $aMPos[0]
    $y_start = $aMPos[1]
EndFunc
Func On_WM_MOVING($hWnd, $Msg, $wParam, $lParam)
    $aMPos = MouseGetPos()
    $rect = DllStructCreate("long left; long top; long right; long bottom", $lParam)
    $left = DllStructGetData($rect, "left")
    $top = DllStructGetData($rect, "top")
    $right = DllStructGetData($rect, "right")
    $bottom = DllStructGetData($rect, "bottom")
    If $left <= $Range And $aMPos[0] < $x_start Then
        DllStructSetData($rect, "left", 0)
        DllStructSetData($rect, "right", $right-$left)
    EndIf
    If $top <= $Range And $aMPos[1] < $y_start Then
        DllStructSetData($rect, "top", 0)
        DllStructSetData($rect, "bottom", $bottom-$top)
    EndIf
    If $right >= (@DesktopWidth - $Range) And $aMPos[0] > $x_start Then
        DllStructSetData($rect, "right", @DesktopWidth)
        DllStructSetData($rect, "left", (@DesktopWidth-$right)+$left)
    EndIf
    If $bottom >= ($taskbarPos[1] - $Range) And $aMPos[1] > $y_start Then
        DllStructSetData($rect, "bottom", $taskbarPos[1])
        DllStructSetData($rect, "top", ($taskbarPos[1]-$bottom)+$top)
    EndIf
    On_WM_ENTERSIZEMOVE()
EndFunc

Can be improved upon. I'm not feeling very inspired tonight.

Edited by Siao

"be smart, drink your wine"

Posted

Wow!

Thanks a lot! This is realy possible! ;):)

  Quote

Can be improved upon

Yes, there is need to move mouse to a new position (without moving the window this while), and also attach window accourding to work area, because if i set position of my taskbar to up/left/right, then window attached incorrectly ;)

I have tryed to solve these issues, but no luck so far...

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

  Siao said:

Here's a quick demo of what I was talking about

Can be improved upon. I'm not feeling very inspired tonight.

Hey this is awesome siao!!

Idea for improve: after moving window to edge should be moved also mouse position to be still on window title bar.

EDIT: now i see MsCreator propose the same, I'm too slow

Edited by Zedna
Posted

This will snap the mouse to the center of the title bar.

#include <GUIConstants.au3>

Const $Range = 100
Const $WM_MOVE = 0x0003
Const $WM_MOVING = 0x0216
Const $WM_ENTERSIZEMOVE = 0x0231
Global $taskbarPos = WinGetPos("[CLASS:Shell_TrayWnd]"), $x_start, $y_start
Global $bEVENTMOVED = False
$gui = GUICreate("Attach Window GUI to screen edge", 350, 200)
GUISetState()
GUIRegisterMsg($WM_ENTERSIZEMOVE, "On_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_MOVING, "On_WM_MOVING")
GuiRegisterMsg($WM_MOVE,"On_WM_MOVE")


While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func On_WM_MOVE()
    $aWPos = WinGetPos($gui,"")
    $aWClient = WinGetClientSize($gui,"")
    $mXpos = $aWPos[0]+($aWPos[2]/2)
    $mYPos = $aWPos[1]+(Abs($aWPos[3]-$aWClient[1])/2)
    MouseMove($mXpos,$mYPos,0)
    Return 0
EndFunc
Func On_WM_ENTERSIZEMOVE()
    $aMPos = MouseGetPos()
    $x_start = $aMPos[0]
    $y_start = $aMPos[1]
EndFunc
Func On_WM_MOVING($hWnd, $Msg, $wParam, $lParam)
    $aMPos = MouseGetPos()
    $rect = DllStructCreate("long left; long top; long right; long bottom", $lParam)
    $left = DllStructGetData($rect, "left")
    $top = DllStructGetData($rect, "top")
    $right = DllStructGetData($rect, "right")
    $bottom = DllStructGetData($rect, "bottom")
    If $left <= $Range And $aMPos[0] < $x_start Then
        DllStructSetData($rect, "left", 0)
        DllStructSetData($rect, "right", $right-$left)
    EndIf
    If $top <= $Range And $aMPos[1] < $y_start Then
        DllStructSetData($rect, "top", 0)
        DllStructSetData($rect, "bottom", $bottom-$top)
    EndIf
    If $right >= (@DesktopWidth - $Range) And $aMPos[0] > $x_start Then
        DllStructSetData($rect, "right", @DesktopWidth)
        DllStructSetData($rect, "left", (@DesktopWidth-$right)+$left)
    EndIf
    If $bottom >= ($taskbarPos[1] - $Range) And $aMPos[1] > $y_start Then
        DllStructSetData($rect, "bottom", $taskbarPos[1])
        DllStructSetData($rect, "top", ($taskbarPos[1]-$bottom)+$top)
    EndIf
    On_WM_ENTERSIZEMOVE()
EndFunc
Posted (edited)
  eltorro said:

This will snap the mouse to the center of the title bar.

This causing window "flying" :) - even if the window is not near the edges. Edited by MsCreatoR

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  MsCreatoR said:

This causing window "flying" :) - even if the window is not near the edges.

It "flys" without it too, on my computer. :)

Posted
  Quote

It "flys" without it too

Without your addition? nope, no "flying" effect on my computer :) (and even on computer of my friend).

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

This should take into account desktop working area:

#include <GUIConstants.au3>

Const $Range = 100
Const $WM_MOVING = 0x0216
Const $WM_ENTERSIZEMOVE = 0x0231
Global $x_start, $y_start

$gui = GUICreate("Attach Window GUI to screen edge", 350, 200)
GUISetState()
GUIRegisterMsg($WM_ENTERSIZEMOVE, "On_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_MOVING, "On_WM_MOVING")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func On_WM_ENTERSIZEMOVE()
    $aMPos = MouseGetPos()
    $x_start = $aMPos[0]
    $y_start = $aMPos[1]
EndFunc
Func On_WM_MOVING($hWnd, $Msg, $wParam, $lParam)
    Local $aMPos = MouseGetPos()
    Local $wRECT = DllStructCreate("long left; long top; long right; long bottom", $lParam)
    $left = DllStructGetData($wRECT, "left")
    $top = DllStructGetData($wRECT, "top")
    $right = DllStructGetData($wRECT, "right")
    $bottom = DllStructGetData($wRECT, "bottom")
    $aDeskRECT = _GetWorkingArea()
    If $aDeskRECT = 0 Then Return
    If $left <= ($aDeskRECT[0] + $Range) And $aMPos[0] < $x_start Then
        DllStructSetData($wRECT, "left", $aDeskRECT[0])
        DllStructSetData($wRECT, "right", $aDeskRECT[0]+($right-$left))
    EndIf
    If $top <= ($aDeskRECT[1] + $Range) And $aMPos[1] < $y_start Then
        DllStructSetData($wRECT, "top", $aDeskRECT[1])
        DllStructSetData($wRECT, "bottom", $aDeskRECT[1]+($bottom-$top))
    EndIf
    If $right >= ($aDeskRECT[2] - $Range) And $aMPos[0] > $x_start Then
        DllStructSetData($wRECT, "right", $aDeskRECT[2])
        DllStructSetData($wRECT, "left", ($aDeskRECT[2]-$right)+$left)
    EndIf
    If $bottom >= ($aDeskRECT[3] - $Range) And $aMPos[1] > $y_start Then
        DllStructSetData($wRECT, "bottom", $aDeskRECT[3])
        DllStructSetData($wRECT, "top", ($aDeskRECT[3]-$bottom)+$top)
    EndIf
    On_WM_ENTERSIZEMOVE()
EndFunc

;===============================================================================
;
; Function Name:    _GetWorkingArea()
; Description:      Returns the coordinates of desktop working area rectangle
; Parameter(s):     None
; Return Value(s):  On Success - Array containing coordinates:
;                               $a[0] = left
;                               $a[1] = top
;                               $a[2] = right
;                               $a[3] = bottom
;                   On Failure - 0
;
;===============================================================================
Func _GetWorkingArea()
#cs
BOOL WINAPI SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
uiAction SPI_GETWORKAREA = 48
#ce
    Local $dRECT = DllStructCreate("long; long; long; long")
    Local $spiRet = DllCall("User32.dll", "int", "SystemParametersInfo", _
                        "uint", 48, "uint", 0, "ptr", DllStructGetPtr($dRECT), "uint", 0)
    If @error Then Return 0
    If $spiRet[0] = 0 Then Return 0
    Local $aRet[4] = [DllStructGetData($dRECT, 1), DllStructGetData($dRECT, 2), DllStructGetData($dRECT, 3), DllStructGetData($dRECT, 4)]
    Return $aRet
EndFunc

As for updating mouse cursor pos, I think I tried MouseMove inside On_WM_MOVING, but it was messing things up - because I move window by modifying RECT structure, and MouseMove also happens to move window. You would have to play around with it and figure out some way, if it's important to you.

Edited by Siao

"be smart, drink your wine"

Posted

  MsCreatoR said:

Without your addition? nope, no "flying" effect on my computer :) (and even on computer of my friend).

Hmm... Maybe you could define "flying" for me. The window for me moves the same way regardless of WM_MOVE. With WM_MOVE the mouse snaps to the center of the title bar. No complications for weirdness.

What AutoIt version are you using?

3.4.2.9 here.

Posted (edited)

  eltorro said:

Hmm... Maybe you could define "flying" for me. The window for me moves the same way regardless of WM_MOVE. With WM_MOVE the mouse snaps to the center of the title bar. No complications for weirdness.

What AutoIt version are you using?

3.4.2.9 here.

Enable "Show window contents while dragging" (Display properties > Appearance > Effects...) and try again. Should notice a difference :)

Edited by Siao

"be smart, drink your wine"

Posted

  Siao said:

Enable "Show window contents while dragging" (Display properties > Appearance > Effects...) and try again. Should notice a difference :)

IT's POSSESSED :) .

Try this instead.

#include <GUIConstants.au3>

Const $Range = 100
Const $WM_MOVE = 0x0003
Const $WM_MOVING = 0x0216
Const $WM_ENTERSIZEMOVE = 0x0231
Global $taskbarPos = WinGetPos("[CLASS:Shell_TrayWnd]"), $x_start, $y_start
Global $bEVENTMOVED = False
$gui = GUICreate("Attach Window GUI to screen edge", 350, 200)
GUISetState()
GUIRegisterMsg($WM_ENTERSIZEMOVE, "On_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_MOVING, "On_WM_MOVING")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    if $bEVENTMOVED = True Then
       $aWPos = WinGetPos($gui,"")
       $aWClient = WinGetClientSize($gui,"")
       $mXpos = $aWPos[0]+($aWPos[2]/2)
       $mYPos = $aWPos[1]+(Abs($aWPos[3]-$aWClient[1])/2)
       MouseMove($mXpos,$mYPos,0)
       $bEVENTMOVED = False
    EndIf
WEnd

Func On_WM_ENTERSIZEMOVE()
    $aMPos = MouseGetPos()
    $x_start = $aMPos[0]
    $y_start = $aMPos[1]
EndFunc
Func On_WM_MOVING($hWnd, $Msg, $wParam, $lParam)
    $aMPos = MouseGetPos()
    $rect = DllStructCreate("long left; long top; long right; long bottom", $lParam)
    $left = DllStructGetData($rect, "left")
    $top = DllStructGetData($rect, "top")
    $right = DllStructGetData($rect, "right")
    $bottom = DllStructGetData($rect, "bottom")
    If $left <= $Range And $aMPos[0] < $x_start Then
        DllStructSetData($rect, "left", 0)
        DllStructSetData($rect, "right", $right-$left)
        $bEVENTMOVED = True
    EndIf
    If $top <= $Range And $aMPos[1] < $y_start Then
        DllStructSetData($rect, "top", 0)
        DllStructSetData($rect, "bottom", $bottom-$top)
        $bEVENTMOVED = True
    EndIf
    If $right >= (@DesktopWidth - $Range) And $aMPos[0] > $x_start Then
        DllStructSetData($rect, "right", @DesktopWidth)
        DllStructSetData($rect, "left", (@DesktopWidth-$right)+$left)
        $bEVENTMOVED = True
    EndIf
    If $bottom >= ($taskbarPos[1] - $Range) And $aMPos[1] > $y_start Then
        DllStructSetData($rect, "bottom", $taskbarPos[1])
        DllStructSetData($rect, "top", ($taskbarPos[1]-$bottom)+$top)
        $bEVENTMOVED = True
    EndIf
    On_WM_ENTERSIZEMOVE()
EndFunc

The mouse should not center unless the window docks.

Posted

  Siao said:

This should take into account desktop working area:

Wow! Thanks Siao! It works Greate!

  eltorro said:

Maybe you could define "flying" for me

I mean that while i am draging the window, mouse with the window is moving constently..

And as Siao mentioned, i have switched-on "Show window contents while dragging" :)

  Siao said:

As for updating mouse cursor pos, I think I tried MouseMove inside On_WM_MOVING, but it was messing things up

Yes, i also have notice about the "effects" when we use MouseMove while user is holding down the cursor... i solve this by MouseClickDrag and then MouseDown() (see example after this one)...

Here i am using only MouseMove, without DllStructSetData()... but here is another "effect" - the window is kind of "shaking" when it's near the edges and also the window might go outside the edges when it's near the corner of the screen:

#include <GUIConstants.au3>

Const $Range = 100
Const $WM_MOVING = 0x0216
Const $WM_ENTERSIZEMOVE = 0x0231
Global $X_START, $Y_START

$Gui = GUICreate("Attach Window GUI to screen edge", 350, 200)
GUISetState()

GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_MOVING, "WM_MOVING")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func WM_ENTERSIZEMOVE()
    Local $aMPos = MouseGetPos()
    $X_START = $aMPos[0]
    $Y_START = $aMPos[1]
EndFunc

Func WM_MOVING($hWnd, $Msg, $wParam, $lParam)
    Local $aMPos = MouseGetPos()
    Local $wRECT = DllStructCreate("long left; long top; long right; long bottom", $lParam)
    $left = DllStructGetData($wRECT, "left")
    $top = DllStructGetData($wRECT, "top")
    $right = DllStructGetData($wRECT, "right")
    $bottom = DllStructGetData($wRECT, "bottom")
    $aDeskRECT = _GetWorkingArea()
    If $aDeskRECT = 0 Then Return
    If $left <= ($aDeskRECT[0] + $Range) And $aMPos[0] < $x_start Then
        MouseMove($aMPos[0] - $left, $aMPos[1], 0)
    EndIf
    If $top <= ($aDeskRECT[1] + $Range) And $aMPos[1] < $y_start Then
        MouseMove($aMPos[0], $y_start - $top, 0)
    EndIf
    If $right >= ($aDeskRECT[2] - $Range) And $aMPos[0] > $x_start Then
        MouseMove($aDeskRECT[2] + $aMPos[0] - $right, $aMPos[1], 0)
    EndIf
    If $bottom >= ($aDeskRECT[3] - $Range) And $aMPos[1] > $y_start Then
        MouseMove($aMPos[0], $aDeskRECT[3] + $aMPos[1] - $bottom, 0)
    EndIf
    WM_ENTERSIZEMOVE()
EndFunc

;===============================================================================
;
; Function Name:    _GetWorkingArea()
; Description:      Returns the coordinates of desktop working area rectangle
; Parameter(s):     None
; Return Value(s):  On Success - Array containing coordinates:
;                        $a[0] = left
;                        $a[1] = top
;                        $a[2] = right
;                        $a[3] = bottom
;                   On Failure - 0
;
;===============================================================================
Func _GetWorkingArea()
#cs
BOOL WINAPI SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
uiAction SPI_GETWORKAREA = 48
#ce
    Local $dRECT = DllStructCreate("long; long; long; long")
    Local $spiRet = DllCall("User32.dll", "int", "SystemParametersInfo", _
                        "uint", 48, "uint", 0, "ptr", DllStructGetPtr($dRECT), "uint", 0)
    If @error Then Return 0
    If $spiRet[0] = 0 Then Return 0
    Local $aRet[4] = [DllStructGetData($dRECT, 1), DllStructGetData($dRECT, 2), DllStructGetData($dRECT, 3), DllStructGetData($dRECT, 4)]
    Return $aRet
EndFuncoÝ÷ Ø ÝêÞƧ{¦¦W°ØL¢ë
X:Ú»­iû^®Ø^YR¶»µ'­
«ZˬyÖ®¶­sb6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC° ¤6öç7Bb33cµ&ævRÒ¤6öç7Bb33cµtÕôÔõdärÒ#`¤6öç7Bb33cµtÕôTåDU%4¤TÔõdRÒ#3¤vÆö&Âb33cµõ5D%BÂb33cµõ5D%@ ¢b33c´wVÒuT7&VFRgV÷C´GF6væF÷ruTFò67&VVâVFvRgV÷C²Â3SÂ#¤uT6WE7FFR ¤uT&Vv7FW$×6rb33cµtÕôTåDU%4¤TÔõdRÂgV÷CµtÕôTåDU%4¤TÔõdRgV÷C²¤uT&Vv7FW$×6rb33cµtÕôÔõdärÂgV÷CµtÕôÔõdärgV÷C² ¥vÆRuTvWD×6rfÇC²fwC²b33c´uTôUdTåEô4Äõ4P¥tVæ@ ¤gVæ2tÕôTåDU%4¤TÔõdR Æö6Âb33c¶Õ÷2ÒÖ÷W6TvWE÷2 b33cµõ5D%BÒb33c¶Õ÷5³Ð b33cµõ5D%BÒb33c¶Õ÷5³Ð¤VæDgVæ0 ¤gVæ2tÕôÔõdärb33c¶væBÂb33c´×6rÂb33c·u&ÒÂb33c¶Å&Ò¢Æö6Âb33c¶Õ÷2ÒÖ÷W6TvWE÷2¢Æö6Âb33c·u$T5BÒFÆÅ7G'V7D7&VFRgV÷C¶ÆöærÆVgC²ÆöærF÷²Æöær&vC²Æöær&÷GFöÒgV÷C²Âb33c¶Å&Ò¢b33c¶ÆVgBÒFÆÅ7G'V7DvWDFFb33c·u$T5BÂgV÷C¶ÆVgBgV÷C²¢b33c·F÷ÒFÆÅ7G'V7DvWDFFb33c·u$T5BÂgV÷C·F÷gV÷C²¢b33c·&vBÒFÆÅ7G'V7DvWDFFb33c·u$T5BÂgV÷C·&vBgV÷C²¢b33c¶&÷GFöÒÒFÆÅ7G'V7DvWDFFb33c·u$T5BÂgV÷C¶&÷GFöÒgV÷C²¢b33c¶FW6µ$T5BÒôvWEv÷&¶æt&V¢bb33c¶FW6µ$T5BÒFVâ&WGW&à¢bb33c¶ÆVgBfÇC³Òb33c¶FW6µ$T5E³Ò²b33cµ&ævRæBb33c¶Õ÷5³ÒfÇC²b33c·÷7F'BFVà FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C¶ÆVgBgV÷C²Âb33c¶FW6µ$T5E³Ò¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C·&vBgV÷C²Âb33c¶FW6µ$T5E³Ò²b33c·&vBÒb33c¶ÆVgB õ&U6WDÖ÷W6U÷2b33c¶Õ÷5³ÒÒb33c¶ÆVgBÂb33c¶Õ÷5³Ò¢VæD`¢bb33c·F÷fÇC³Òb33c¶FW6µ$T5E³Ò²b33cµ&ævRæBb33c¶Õ÷5³ÒfÇC²b33c·÷7F'BFVà¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C·F÷gV÷C²Âb33c¶FW6µ$T5E³Ò¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C¶&÷GFöÒgV÷C²Âb33c¶FW6µ$T5E³Ò²b33c¶&÷GFöÒÒb33c·F÷ õ&U6WDÖ÷W6U÷2b33c¶Õ÷5³ÒÂb33c·÷7F'BÒb33c·F÷¢VæD`¢bb33c·&vBfwC³Òb33c¶FW6µ$T5E³%ÒÒb33cµ&ævRæBb33c¶Õ÷5³ÒfwC²b33c·÷7F'BFVà¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C·&vBgV÷C²Âb33c¶FW6µ$T5E³%Ò¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C¶ÆVgBgV÷C²Âb33c¶FW6µ$T5E³%ÒÒb33c·&vB²b33c¶ÆVgB õ&U6WDÖ÷W6U÷2b33c¶FW6µ$T5E³%Ò²b33c¶Õ÷5³ÒÒb33c·&vBÂb33c¶Õ÷5³Ò¢VæD`¢bb33c¶&÷GFöÒfwC³Òb33c¶FW6µ$T5E³5ÒÒb33cµ&ævRæBb33c¶Õ÷5³ÒfwC²b33c·÷7F'BFVà¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C¶&÷GFöÒgV÷C²Âb33c¶FW6µ$T5E³5Ò¢FÆÅ7G'V7E6WDFFb33c·u$T5BÂgV÷C·F÷gV÷C²Âb33c¶FW6µ$T5E³5ÒÒb33c¶&÷GFöÒ²b33c·F÷ õ&U6WDÖ÷W6U÷2b33c¶Õ÷5³ÒÂb33c¶FW6µ$T5E³5Ò²b33c¶Õ÷5³ÒÒb33c¶&÷GFöÒ¢VæD`¢tÕôTåDU%4¤TÔõdR¤VæDgVæ0 ¤gVæ2õ&U6WDÖ÷W6U÷2b33cµõõ2Âb33cµõõ2 Ö÷W6T6Æ6´G&rgV÷C´ÆVgBgV÷C²Âb33cµõ5D%BÂb33cµõ5D%BÂb33cµõõ2Âb33cµõõ2 Ö÷W6TF÷vâgV÷C´ÆVgBgV÷C²¤VæDgVæ0 £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ°£²gVæ7FöâæÖS¢ôvWEv÷&¶æt&V£²FW67&Föã¢&WGW&ç2FR6ö÷&FæFW2öbFW6·F÷v÷&¶ær&V&V7FævÆP£²&ÖWFW"2¢æöæP£²&WGW&âfÇVR2¢öâ7V66W72Ò'&6öçFæær6ö÷&FæFW3 £²b33c¶³ÒÒÆVg@£²b33c¶³ÒÒF÷£²b33c¶³%ÒÒ&v@£²b33c¶³5ÒÒ&÷GFöУ²öâfÇW&RÒ£°£³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2ôvWEv÷&¶æt&670¤$ôôÂtä77FVÕ&ÖWFW'4æfòTåBV7FöâÂTåBV&ÒÂdôBe&ÒÂTåBeväæ°§V7Föâ5ôtUEtõ$´$TÒC¢66P¢Æö6Âb33c¶E$T5BÒFÆÅ7G'V7D7&VFRgV÷C¶Æöæs²Æöæs²Æöæs²ÆöærgV÷C²¢Æö6Âb33c·7&WBÒFÆÄ6ÆÂgV÷CµW6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷Cµ77FVÕ&ÖWFW'4æfògV÷C²Âð¢gV÷C·VçBgV÷C²ÂCÂgV÷C·VçBgV÷C²ÂÂgV÷C·G"gV÷C²ÂFÆÅ7G'V7DvWEG"b33c¶E$T5BÂgV÷C·VçBgV÷C²Â¢bW'&÷"FVâ&WGW&â¢bb33c·7&WE³ÒÒFVâ&WGW&â¢Æö6Âb33c¶&WE³EÒÒ´FÆÅ7G'V7DvWDFFb33c¶E$T5BÂÂFÆÅ7G'V7DvWDFFb33c¶E$T5BÂ"ÂFÆÅ7G'V7DvWDFFb33c¶E$T5BÂ2ÂFÆÅ7G'V7DvWDFFb33c¶E$T5BÂBТ&WGW&âb33c¶&W@¤VæDgVæ0

And here the problem is that the mouse is moving before window position changed, and i can understand it, because registered function needs to return before it send the commands... but i don't know how to solve this :).

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  Quote

Try the script I posted in my last post.

I tryed, thanks, but it not it... the cursor is jumping only after i release the mouse, and also it returns always to center.. not realy good :)

BTW: instead of using the main loop, you can register another function:

.......

Const $WM_EXITSIZEMOVE = 0x0232

.......

GUIRegisterMsg($WM_EXITSIZEMOVE, "On_WM_EXITSIZEMOVE")

.......

Func On_WM_EXITSIZEMOVE()
    If $bEVENTMOVED = True Then
        $aWPos = WinGetPos($gui)
        $aWClient = WinGetClientSize($gui)
        $mXpos = $aWPos[0]+($aWPos[2]/2)
        $mYPos = $aWPos[1]+(Abs($aWPos[3]-$aWClient[1])/2)
        MouseMove($mXpos,$mYPos,0)
        $bEVENTMOVED = False
    EndIf
EndFunc

:)

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...