|
MessageBoxTimeoutっていうHiddenAPI(非公開API)
を使って見るとか。
(Sample)
Private Declare Function MessageBoxTimeoutA Lib "User32" _
(ByVal Hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal uType As VbMsgBoxStyle, _
ByVal wLanguageID As Long, _
ByVal dwMilliseconds As Long) As Long
Private Const MB_TIMEOUT = &H7D00
Sub TimerMsgbox()
Dim Sec As Long
Dim Result As Long
Dim sMsg As String
Sec = 4 * 1000 '4秒
sMsg = "4秒後に消えます。"
Result = MessageBoxTimeoutA(Application.Hwnd, sMsg, _
Application.Name, vbOKCancel + vbMsgBoxSetForeground, 0&, Sec)
Select Case Result
Case vbOK
sMsg = "OKボタンが押された。"
Case vbCancel
sMsg = "キャンセルボタンが押された。"
Case MB_TIMEOUT
sMsg = "4秒経ちました。"
End Select
MsgBox sMsg
End Sub
|
|