Jump to content

How to check is a Window is moving ?


Iuli
 Share

Recommended Posts

Hi,

I really got stuck today with this problem. How can i check if a window is moving ? I did this for the GUI created with AutoIT, via GUIRegisterMsg (). But how can i do this for other windows ?

Thank you very much,

Iuli.

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]
Link to comment
Share on other sites

That will not work. For example, if i just click the top part of a window (where title is placed), without actually moving it, GUIRegisterMsg () will return that the window is moving, what i cannot do with WinGetPos.

Any other suggestions ?

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]
Link to comment
Share on other sites

Hi,

a click on top of the window doesn't mean that the window is really moved. It's 'prepared' for moving.

This is tested with Winword 2003 and only fired if the window is really moved:

Opt("WinTitleMatchMode", 2)
ShellExecute ("winword.exe")
WinWait ("Word")
$getpos1st = WinGetPos ("Word")

While ProcessExists ("Winword.exe")
    $getpos2nd = WinGetPos ("Word")
    If $getpos1st [0] <> $getpos2nd [0] Or $getpos1st [1] <> $getpos2nd [1] Then
        $getpos1st [0] = $getpos2nd [0]
        $getpos1st [1] = $getpos2nd [1]
        ConsoleWrite ("Window moved" & @CRLF)
    EndIf
    Sleep (50)
WEnd

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

  • Moderators

http://www.autoitscript.com/forum/index.php?showtopic=56536

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

It will not register the windows movement.

Looks like the OP is stuck using position polling or writing SetWindowsHookEx method then.

Edit:

Or placing their own GUI as a child to the window in question, and using the GUIRegisterMsg() method that way.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Looks like the OP is stuck using position polling or writing SetWindowsHookEx method then.

Edit:

Or placing their own GUI as a child to the window in question, and using the GUIRegisterMsg() method that way.

SmOke_N, i tried the method you mentioned, the one with child GUI. It doesn't work. If you move the parent window, the child window does not respond as it is moved. Here's the code i tried :D

#include "WinAPIEx.au3"
$ActiveWin=WinGetTitle("[active]")
$ActiveWinPos=WinGetPos($ActiveWin)
$ChildGUI=GUICreate("ChildGUI",$ActiveWinPos[2],$ActiveWinPos[3],0,0)
GUIRegisterMsg(0x0216,"IsMoving")
GUISetState(@SW_SHOW)
$ParentWindow=WinGetHandle($ActiveWin)
_WinAPI_SetParent($ChildGUI, $ParentWindow)

Func IsMoving ($hWnd, $Msg, $wParam, $lParam) 
    ConsoleWrite("Working" & @CRLF)
EndFunc

While 1
WEnd

Did i do something wrong ?

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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