I want to detect if a window is resized or moved using this code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 195, 47, 192, 124, BitOR($WS_SIZEBOX, $WS_SYSMENU))
$Button1 = GUICtrlCreateButton("OK", 16, 8, 75, 25)
$Button2 = GUICtrlCreateButton("CANCEL", 104, 8, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AutoItSetOption('WinTitleMatchMode', 2)
Local $aPos[4], $aNewPos[4]
$aPos = WinGetPos($Form1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0, '', 'Button OK is pressed')
Case $Button2
MsgBox(0, '', 'Button CANCEL is presses')
EndSwitch
WEnd
I try to check window size and position but I can't make a loop because the script stops while in the while loop.
I have also tried to edit while, call position etc.
Because I'm still not 100% sure, what you are trying to achieve. I'll post two solutions.
includes: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3>
includes: #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3>