_MsgBoxThread('标题', '内容')
Func _MsgBoxThread($sTitle, $sText)
_Msgbox(4096+0x80, $sTitle, $sText, WinGetHandle(AutoItWinGetTitle()), 'shell32.dll', 239)
EndFunc
Func _Msgbox($iFlags, $sTitle, $sText, $hParent = 0, $hInstance = 0, $iIcon = 0);不阻塞msgbox
Local $tMBPs = DllStructCreate('uint Size;hwnd hOwner;ptr hInstance;ptr Text;ptr Caption;dword Style;ptr Icon;dword_ptr ContextHelpId;ptr MsgBoxCallback;dword LanguageId')
Local $Title = DllStructCreate('wchar[' & (StringLen($sTitle) + 1) & ']')
Local $tText = DllStructCreate('wchar[' & (StringLen($sText) + 1) & ']')
Local $tIcon, $hWnd = 0, $Error = 0, $Ret
If ($iIcon) And (BitAND($iFlags, 0x80)) Then
If Not IsString($iIcon) Then $iIcon = '#' & $iIcon
$tIcon = DllStructCreate('wchar[' & (StringLen($iIcon) + 1) & ']')
$hInstance = _WinAPI_GetModuleHandle($hInstance)
If Not $hInstance Then
$Ret = DllCall('kernel32.dll', 'ptr', 'GetModuleHandleW', 'ptr', 0)
If Not @error Then $hInstance = $Ret[0]
EndIf
Else
$tIcon = 0
EndIf
DllStructSetData($Title, 1, $sTitle)
DllStructSetData($tText, 1, $sText)
DllStructSetData($tIcon, 1, $iIcon)
DllStructSetData($tMBPs, 'Size', DllStructGetSize($tMBPs))
DllStructSetData($tMBPs, 'hOwner', $hParent)
DllStructSetData($tMBPs, 'hInstance', $hInstance)
DllStructSetData($tMBPs, 'Text', DllStructGetPtr($tText))
DllStructSetData($tMBPs, 'Caption', DllStructGetPtr($Title))
DllStructSetData($tMBPs, 'Style', $iFlags)
DllStructSetData($tMBPs, 'Icon', DllStructGetPtr($tIcon))
DllStructSetData($tMBPs, 'ContextHelpId', 0)
DllStructSetData($tMBPs, 'MsgBoxCallback', 0)
DllStructSetData($tMBPs, 'LanguageId', 0)
DllCall('kernel32.dll', 'ptr', 'CreateThread', 'ptr', 0, 'dword_ptr', 0, 'ptr', _RTGetProcAddress(_WinAPI_GetModuleHandle('user32.dll'), 'MessageBoxIndirectW'), 'ptr', DllStructGetPtr($tMBPs), 'dword', 0, 'dword*', 0)
Sleep (100)
$tMBPs = 0
$tText = 0
$tIcon = 0
$Title = 0
Return SetError($Error, 0, $hWnd)
EndFunc