Ok! Yes. I think this will work. Thank you everybody.
#include <APISysConstants.au3>
#include <GUIMenu.au3>
#include <WinAPIProc.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>
Global $hEventProc = DllCallbackRegister(_EventProc, "none", "ptr;dword;hwnd;long;long;dword;dword")
Global $hEventHook = _WinAPI_SetWinEventHook($EVENT_MIN, $EVENT_MAX, DllCallbackGetPtr($hEventProc))
OnAutoItExitRegister(OnAutoItExit)
Global $iPid = Run(@SystemDir & "\notepad.exe")
While ProcessExists($iPid)
Sleep(1000)
WEnd
Func OnAutoItExit()
_WinAPI_UnhookWinEvent($hEventHook)
DllCallbackFree($hEventProc)
EndFunc
Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime)
#forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime
Switch $iEvent
Case $EVENT_SYSTEM_MOVESIZEEND
ConsoleWrite("End" & @CRLF)
Case $EVENT_SYSTEM_MOVESIZESTART
ConsoleWrite("Start" & @CRLF)
EndSwitch
EndFunc