resourcestring<br> M_CAPTION = '提示';<br>......<br>function EnumFunc(hwnd: THandle; lpParam: Integer): Boolean; stdcall;<br>var<br> Buffer: array [0..MAX_TITLE - 1] of Char;<br>begin<br> Result := True;<br> FillChar(Buffer, SizeOf(Buffer), 0);<br> if GetWindowText(hwnd, Buffer, SizeOf(Buffer)) > 0 then<br> if PData(lpParam)^.Title = Buffer then<br> begin<br> PData(lpParam)^.hwnd := hwnd;<br> Result := False;<br> end;<br>end;<br><br>procedure TimerFunc(hwnd: THandle; uMsg, idEvent: UINT; dwTime: Cardinal); stdcall;<br><br> function GetTitleHandle(Title: string): THandle;<br> var<br> Data: TData;<br> begin<br> FillChar(Data, SizeOf(Data), 0);<br> Move(Title[1], Data.Title, Length(Title));<br> EnumWindows(@EnumFunc, Integer(@Data));<br> Result := Data.hwnd;<br> end;<br><br>var<br> Child: THandle;<br>begin<br> Child := GetTitleHandle(M_CAPTION);<br> if Child <> 0 then<br> PostMessage(Child, WM_CLOSE, 0, 0);<br>end;<br>function SplashMsgBox(const Handle: THandle; const Text: string; const aiTimeout: Integer): Integer;<br>begin<br> SetTimer(Handle, 2, aiTimeout, @TimerFunc);<br> Result := MessageBox(Handle, PChar(Text), PChar(M_CAPTION),<br> MB_OKCANCEL or MB_ICONQUESTION); { MB_OKCANCEL do not localize !! }<br> KillTimer(Handle, 2);<br>end;