| Модальные окна сообщений |
|---|
|
Если Вы исполняете свою программу на JScript (или VBScript) под дополнительным
хостом скриптов, то Вы можете обращаться к объекту Window (его методам и свойствам).
Создание модальных окон сообщений: Эта функция позволяет создавать модальные окна сообщений (относительно основного диалогового окна), в то время как прием с созданием ActiveX "WScript.Shell" позволяет создавать только немодальные окна сообщений. // File: messagebox.w_js Window.AppendMenu(0,"MF_STRING",8000,"&Show the message box"); Window.DrawMenuBar(); function WM_COMMAND(id) { if (id != 8000) return; var title = "The Caption for message box"; var message = "The message for you"; var mask = 64; // The meaning of mask is the same as in the Microsoft // Win32R application programming interface MessageBox // function. The following tables show the values and // their meanings. You can combine values in these tables. // Button Types // 0 Show OK button. // 1 Show OK and Cancel buttons. // 2 Show Abort, Retry, and Ignore buttons. // 3 Show Yes, No, and Cancel buttons. // 4 Show Yes and No buttons. // 5 Show Retry and Cancel buttons. // Icon Types // 16 Show "Stop Mark" icon. // 32 Show "Question Mark" icon. // 48 Show "Exclamation Mark" icon. // 64 Show "Information Mark" icon. var i = Window.MessageBox(title, message, mask); // 1 OK button // 2 Cancel button // 3 Abort button // 4 Retry button // 5 Ignore button // 6 Yes button // 7 No button Window.TextOut(0,50,50,"The return value: " + i); Window.UpdateWindow(); } ' File: messagebox.w_vbs (VBScript)
Window.AppendMenu 0,"MF_STRING",8000,"&Show the message box"
Window.DrawMenuBar
Function WM_COMMAND(id)
If (id = 8000) Then
title = "The Caption for message box"
message = "The message for you"
mask = 64
' The meaning of mask is the same as in the Microsoft
' Win32R application programming interface MessageBox
' function. The following tables show the values and
' their meanings. You can combine values in these tables.
' Button Types
' 0 Show OK button.
' 1 Show OK and Cancel buttons.
' 2 Show Abort, Retry, and Ignore buttons.
' 3 Show Yes, No, and Cancel buttons.
' 4 Show Yes and No buttons.
' 5 Show Retry and Cancel buttons.
' Icon Types
' 16 Show "Stop Mark" icon.
' 32 Show "Question Mark" icon.
' 48 Show "Exclamation Mark" icon.
' 64 Show "Information Mark" icon.
i = Window.MessageBox(title, message, mask)
' 1 OK button
' 2 Cancel button
' 3 Abort button
' 4 Retry button
' 5 Ignore button
' 6 Yes button
' 7 No button
Window.TextOut 0,50,50,"The return value: " & i
Window.UpdateWindow
End If
End Function
|
| Дополнительный хост скриптов. |