VBS Popup方法应用

'ms-help://MS.MSDNQTR.v90.en/script56/html/wsMthPopup.htm
'Popup method: Displays text in a pop-up message box.
'intButton = object.Popup(strText,[nSecondsToWait],[strTitle],[nType])
'[Arguments]
'object
'WshShell object.
'strText
'String value containing the text you want to appear in the pop-up message box.
'nSecondsToWait
'Optional. Numeric value indicating the maximum length of time (in seconds) you want the pop-up message box displayed.
'strTitle
'Optional. String value containing the text you want to appear as the title of the pop-up message box.
'nType
Const wshOKDialg = 0
Const wshOKCancelDialog = 1
Const wshAbortRetryIgnoreDialog = 2
Const wshYesNoCancelDialog = 3
Const wshYesNoDialog = 4
Const wshRetryCancelDialog = 5
Const wshStopMark = 16
Const wshQuestionMark = 32
Const wshExclamationMark = 48
Const wshInformationMark = 64
'Optional. Numeric value indicating the type of buttons and icons you want in the pop-up message box.
' These determine how the message box is used.
'IntButton
Const wshOK = 1
Const wshCancel = 2
Const wshAbort = 3
Const wshRetry = 4
Const wshIngore = 5
Const wshYes = 6
Const wshNo = 7
Const wshDefault = -1
'Integer value indicating the number of the button the user clicked to dismiss the message box.
'This is the value returned by the Popup method.
'Remarks
'The Popup method displays a message box regardless of which host executable file is running
'(WScript.exe or CScript.exe). If nSecondsToWaitis equals zero (the default),
'the pop-up message box remains visible until closed by the user. If nSecondsToWaitis is greater than zero,
'the pop-up message box closes after nSecondsToWait seconds. If you do not supply the argument strTitle,
'the title of the pop-up message box defaults to "Windows Script Host."

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
intReturn = WshShell.Popup("Do you want to delete this file?", _
 5, "Delete File", wshYesNoDialog + wshExclamationMark)

Select Case intReturn
 Case 6   WScript.Echo "Yes btn clicked."
 Case 7   WScript.Echo "No btn clicked." 
 Case -1  WScript.Echo "The popup timed out."
End Select

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值