; open a detached MsgBox and get handle
$hwMSG = _MsgBox(0, "Hello", "Content", 5) ; auto close in 5 seconds
; get handle of the text label
$hMSGtext = ControlGetHandle($hwMSG, "", "[CLASS:Static; INSTANCE:1]")
; get handle of the OK button
$hButton = ControlGetHandle($hwMSG, "", "[CLASS:Button; INSTANCE:1]")
$countdown = 4
While WinExists($hwMSG) ; wait the autoclose of the MsgBox
; change the text in the MsgBox
ControlSetText($hwMSG, '', $hMSGtext, "Off in " & $countdown & " sec") ; label
ControlSetText($hwMSG, '', $hButton, $countdown) ; ok button
Sleep(1000)
$countdown -= 1
WEnd
; spawn a detached MsgBox and returns an handle
Func _MsgBox($flag = 0, $title = '', $text = '', $timeout = 0)
Local $sCommand = 'MsgBox(' & $flag & ', "' & $title & '", "' & $text & '", ' & $timeout & ')'
$sCommand = '"' & StringReplace($sCommand, '"', '""') & '"'
Local $hPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand)
Sleep(1000)
; Retrieve a list of window handles. (MsgBox included)
Local $aList = WinList(), $hwMSGBOX
For $i = 1 To $aList[0][0]
If WinGetProcess($aList[$i][1]) = $hPID Then
$hwMSGBOX = $aList[$i][1]
ExitLoop
EndIf
Next
Return $hwMSGBOX
EndFunc ;==>_MsgBox