From the snippet:
https://www.autoitscript.com/wiki/Snippets_(_GUI_)#Center_Window_on_Screen
#include <GUIConstantsEx.au3>
Global Const $GUI = GUICreate("Test Window",300 ,300 ,100 ,100)
GUISetState(@SW_SHOWNORMAL)
Sleep(2000)
_Middle($GUI, "Test Window")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Func _Middle(Const $win, Const $txt)
Local Const $size = WinGetClientSize($win, $txt)
Local Const $y = (@DesktopHeight / 2) - ($size[1] / 2)