1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Sub MsgBox_AutoReply() '------------------------------------------------------------------------------ ' Vyukova ukazka na automatickou odpoved po 3 vterinach cekani. ' Pres MsgBox to ve VB 6 nejde, tak pouzijeme WScript. '------------------------------------------------------------------------------ Const WSH_TYPE_BTN_OK = &H0 ' Button OK ( hexadecimal &H0 or decimal value 0 ) Const WSH_TYPE_BTN_OK_CANC = &H1 ' Button OK and Cancel ( hexadecimal &H1 or decimal value 1 ) Const WSH_TYPE_BTN_AB_RE_IG = &H2 ' Button Abort, Retry and Ignore ( hexadecimal &H2 or decimal value 2 ) Const WSH_TYPE_BTN_YES_NO_CANC = &H3 ' Button Yes, No and Cancel ( hexadecimal &H3 or decimal value 3 ) Const WSH_TYPE_BTN_YES_NO = &H4 ' Button Yes and No ( hexadecimal &H4 or decimal value 4 ) Const WSH_TYPE_BTN_RETRY_CANC = &H5 ' Button Retry and Cancel ( hexadecimal &H5 or decimal value 5 ) Const WSH_TYPE_BTN_CANC_TRYAG_CONT = &H6 ' Button Cancel, Try Again and Continue ( hexadecimal &H6 or decimal value 6 ) Const WSH_TYPE_ICON_STOP = &H10 ' Icon Stop Mark ( hexadecimal &H10 or decimal value 16 ) Const WSH_TYPE_ICON_QUES = &H20 ' Icon Question Mark ( hexadecimal &H20 or decimal value 32 ) Const WSH_TYPE_ICON_EXCL = &H30 ' Icon Exclamation Mark ( hexadecimal &H30 or decimal value 48 ) Const WSH_TYPE_ICON_INFO = &H40 ' Icon Information Mark ( hexadecimal &H40 or decimal value 64 ) Const WSH_TYPE_DEF_BTN_SECND = &H100 ' The second button is the default button ( hexadecimal &H100 or decimal value 256 ) Const WSH_TYPE_DEF_BTN_THIRD = &H200 ' The third button is the default button ( hexadecimal &H200 or decimal value 512 ) Const WSH_TYPE_DEF_MSG_TOPWIN = &H1000 ' The message box is a system modal message box and appears in a topmost window ( hexadecimal &H1000 or decimal value 4096 ) Const WSH_TYPE_DEF_TEXT_RJUST = &H80000 ' The text is right-justified ( hexadecimal &H80000 or decimal value 524288 ) Const WSH_TYPE_DEF_TEXT_RTL = &H100000 ' The message and caption text display in right-to-left reading order, which is useful for some languages ( hexadecimal &H100000 or decimal value 1048576 ) Const WSH_RETVAL_NOACTION = -1 ' The user did not click a button before nSecondsToWait seconds elapsed ( decimal value ) Const WSH_RETVAL_OK = 1 ' OK button ( decimal value ) Const WSH_RETVAL_CANC = 2 ' Cancel button ( decimal value ) Const WSH_RETVAL_ABORT = 3 ' Abort button ( decimal value ) Const WSH_RETVAL_RETRY = 4 ' Retry button ( decimal value ) Const WSH_RETVAL_IGNORE = 5 ' Ignore button ( decimal value ) Const WSH_RETVAL_YES = 6 ' Yes button ( decimal value ) Const WSH_RETVAL_NO = 7 ' No button ( decimal value ) Const WSH_RETVAL_TRY_AGAIN = 10 ' Try Again button ( decimal value ) Const WSH_RETVAL_CONTINUE = 11 ' Continue button ( decimal value ) Dim lv_Answer As Long, strDesktop As String, oShellLink As Object '--- WScript Dim lo_WshShell_Any As Object Dim lo_WshShell_Ref As WshShell 'Add reference to Windows Script Host Object Model library (Project|References), i.e. WSHOM.OCX ' -- 1. priklad deklarace bez reference na knihovnu Set lo_WshShell_Any = Nothing Set lo_WshShell_Any = CreateObject("WScript.Shell") ' -- 2. priklad deklarace s reference na knihovnu Set lo_WshShell_Ref = Nothing Set lo_WshShell_Ref = New WshShell ' -- Dotaz lv_Answer = lo_WshShell_Ref.Popup("Mate radi cokoladu?", 1, "Title", 4 + 32) Select Case lv_Answer Case WSH_RETVAL_NOACTION ' -1 MsgBox "Mlceni znamena souhlas." Case WSH_RETVAL_NO ' 7 MsgBox "Vida, nemate." Case WSH_RETVAL_YES ' 6 MsgBox "Ja taky." End Select ' -- Informace lo_WshShell_Ref.Popup "Dokonceno", 3, "Title", WSH_TYPE_BTN_OK + WSH_TYPE_ICON_INFO '+ WSH_TYPE_DEF_MSG_TOPWIN End Sub