如何在MsgBox

时间:2016-07-12 19:50:59

标签: vbscript

我正在使用VBScript中的个人项目,我想使用vbApplicationModal常量,因此单击窗口将导致它闪烁,就像错误消息一样。问题是,我不知道将它放在MsgBox中的哪个位置。我有:

X=MsgBox("Your details from this computer are being harvested using an altered malicious build of IBM Watson.", 0+48+4096, "IBM Watson")

但是,我不知道在哪里放vbApplicationModal或替代值(0)。正如您所看到的,我已经使用了图标和按钮的值而不是他们的vb代码(0表示只有' OK',48表示有一个黄色三角形 ,4096表示窗口始终位于其他窗口之上)因为它更短。我是否也必须使用该值,还是可以混合vb值和代码?

1 个答案:

答案 0 :(得分:0)

您可以查看 MsgBox Function

您可以在上面的链接

中混合使用值

例如:

Sample = msgBox("Option codes 0+64." & vbCrLf & vbCrLf & "This is an information situation with OK only",0+64, "Information.")
    Select Case Sample
        Case 1
            wScript.Echo "You acknowledged."
    End Select

Sample = msgBox("Option codes 1+48." & vbCrLf & vbCrLf & "This is a warning situation with OK and Cancel",1+48, "WARNING!")
    Select Case Sample
        Case 1
            wScript.Echo "You chose OK."
        Case 2
            wScript.Echo "You chose Cancel."
    End Select

Sample = msgBox("Option codes 2+16." & vbCrLf & vbCrLf & "This is a critical situation with Abort, Retry, and Ignore",2+16, "CRITICAL!")
    Select Case Sample
        Case 3
            wScript.Echo "You chose Abort."
        Case 4
            wScript.Echo "You chose Retry."
    Case 5
        wScript.Echo "You chose Ignore."
    End Select

Sample = msgBox("Option codes 0+16." & vbCrLf & vbCrLf & "This is a critical error situation with OK only",0+16, "CRITICAL ERROR!")
    Select Case Sample
        Case 1
            wScript.Echo "You acknowledged."
    End Select

Sample = msgBox("Option codes 3+32." & vbCrLf & vbCrLf & "This is a question situation with Yes, No, or Cancel",3+32, "Question?")
    Select Case Sample
        Case 6
            wScript.Echo "You said Yes."
        Case 7
            wScript.Echo "You said No."
        Case 2
            wScript.Echo "You clicked Cancel."
    End Select

Sample = msgBox("Option codes 4+32." & vbCrLf & vbCrLf & "This is a question situation with Yes or No only",4+32, "Question?")
    Select Case Sample
        Case 6
            wScript.Echo "You said Yes."
        Case 7
            wScript.Echo "You said No."
    End Select

Sample = msgBox("Option codes 5+16." & vbCrLf & vbCrLf & "This is a critical error situation with Retry or Cancel",5+16, "CRITICAL ERROR!")
    Select Case Sample
        Case 4
            wScript.Echo "You clicked Retry."
        Case 2
            wScript.Echo "You clicked Cancel."
    End Select

编辑:另一个例子:

{{1}}