#Include <WinAPI.au3>
Global Const $tagMSGBOXPARAMS = 'uint Size;hwnd hOwner;ptr hInstance;ptr Text;ptr Caption;dword Style;ptr Icon;dword_ptr ContextHelpId;ptr MsgBoxCallback;dword LanguageId'
For $Idx = 1 To 4 Step 1
_MsgBox( 16 * $Idx, 'Title', 'Text_' & $Idx, _WinAPI_GetModuleHandle(0) )
Next
While Sleep( 100 )
WEnd
Func _MsgBox( $iFlags, $sTitle, $sText, $hInstance, $hParent = 0 ) ;Author: Yashied
Local $aRet, $tMBP = DllStructCreate($tagMSGBOXPARAMS), _
$tTitle = DllStructCreate('wchar[' & (StringLen($sTitle) + 1) & ']')
$tText = DllStructCreate('wchar[' & (StringLen($sText) + 1) & ']')
; ---
DllStructSetData($tTitle, 1, $sTitle)
DllStructSetData($tText, 1, $sText)
With $tMBP
.Size = DllStructGetSize($tMBP)
.hOwner = $hParent
.hInstance = $hInstance
.Text = DllStructGetPtr($tText)
.Caption = DllStructGetPtr($tTitle)
.Style = BitAND($iFlags, 0xFFFFBFF8)
.Icon = 0
.ContextHelpId = 0
.MsgBoxCallback = 0
.LanguageId = 0
EndWith
$aRet = DllCall( 'kernel32.dll', 'ptr', 'GetModuleHandleW', 'wstr', 'user32.dll' )
If Not @Error And $aRet[0] Then
$aRet = DllCall( 'kernel32.dll', 'ptr', 'GetProcAddress', 'ptr', $aRet[0], 'str', 'MessageBoxIndirectW' )
If Not @Error And $aRet[0] Then _
$aRet = DllCall( 'kernel32.dll', 'ptr', 'CreateThread', 'ptr', 0, 'dword_ptr', 0, 'ptr', $aRet[0], 'ptr', DllStructGetPtr($tMBP), 'dword', 0, 'dword*', 0 )
EndIf
Sleep( 10 ) ;Do not delete
EndFunc