有一个没有公开的api函数MessageBoxTimeout
Private Declare Function MessageBoxTimeout Lib "user32" Alias "MessageBoxTimeoutA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long, ByVal wlange As Long, ByVal dwTimeout As Long) As Long
Private Sub Command1_Click()
MessageBoxTimeout Me.hwnd, "xxx", "title", vbInformation, 0, 3000 '3秒钟
End Sub