自動的に閉じる制限時間付きMsgBox
#If Win64 Then
' Excel が64ビット版の場合の関数定義です。
Private Declare PtrSafe Function MessageBoxTimeoutA Lib "User32.dll" _
(ByVal hWnd As LongPtr, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal uType As VbMsgBoxStyle, _
ByVal wLanguageID As Long, _
ByVal dwMilliseconds As Long) As Long
#Else
' Excel が32ビット版の場合の関数定義です。
Private Declare Function MessageBoxTimeoutA Lib "User32.dll" _
(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
#End If
Sub Macro()
'MsgBox "おはよう"
MessageBoxTimeoutA 0&, "おはよう", "2秒で閉じるメッセージ", 0, 0&, 2 * 1000
'MsgBox "こんんちは", 1
MessageBoxTimeoutA 0&, "こんんちは", "2秒で閉じるメッセージ", 1, 0&, 2 * 1000
'rtn = MsgBox("こんばんわ", 67, "タイトルも変えられますよ")
rtn = MessageBoxTimeoutA(0&, "こんばんわ", "2秒で閉じるメッセージ", 3, 0&, 2 * 1000)
MessageBoxTimeoutA 0&, "ゆっくりしていってね!!!", "ゆっくり閉じるメッセージ", 0, 0&, 60 * 1000
For i = 0 To 5
MessageBoxTimeoutA 0&, "type=" & i, "1秒で閉じるメッセージ", i, 0&, 1 * 1000
Next
For i = 0 To 5
MessageBoxTimeoutA 0&, "重大なメッセージ" & Chr(13) & "type=" & i & " + 16", "1秒で閉じるメッセージ", i + 16, 0&, 1 * 1000
Next
For i = 0 To 5
MessageBoxTimeoutA 0&, "警告クエリ" & vbCrLf & "type=" & i & " + 32", "1秒で閉じるメッセージ", i + 32, 0&, 1 * 1000
Next
For i = 0 To 5
MessageBoxTimeoutA 0&, "警告メッセージ" & vbCrLf & "type=" & i & " + 48", "1秒で閉じるメッセージ", i + 48, 0&, 1 * 1000
Next
For i = 0 To 5
MessageBoxTimeoutA 0&, "情報メッセージ" & vbCrLf & "type=" & i & " + 64", "1秒で閉じるメッセージ", i + 64, 0&, 1 * 1000
Next
MessageBoxTimeoutA 0&, _
" ____∧∧ / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄" & vbCrLf & _
" ~' ____(,,゚Д゚)< 次に逝ってよし!" & vbCrLf & _
" UU U U \________" _
, "10秒で閉じるメッセージ", 0 + 64, 0&, 10 * 1000
End Sub
VBScript
<!-- :
@%windir%\System32\cscript.exe //nologo "%~f0?.wsf"
@exit /b %errorlevel%
-->
<job>
<script language="VBScript">
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Popup "おはよう",5, "5秒で閉じるメッセージ",0
objShell.Popup "こんんちは",5, "5秒で閉じるメッセージ",1
For i = 0 To 5
objShell.Popup "type=" & i, 1 , "1秒で閉じるメッセージ", i
Next
For i = 0 To 5
objShell.Popup "重大なメッセージ" & Chr(13) & "type=" & i & " + 16",1, "1秒で閉じるメッセージ",i+16
Next
For i = 0 To 5
objShell.Popup "警告クエリ" & Chr(13) & "type=" & i & " + 32",1, "1秒で閉じるメッセージ",i+32
Next
</script>
</job>
0件のコメント