• Welcome to Jose's Read Only Forum 2023.
 

IWshShell.Popuop Method

Started by José Roca, July 14, 2008, 07:50:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code generates a simple pop-up window.

JScript


var WshShell = WScript.CreateObject("WScript.Shell");
var BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32);
switch(BtnCode) {
   case 6:
      WScript.Echo("Glad to hear you feel alright.");
      break;
   case 7:
      WScript.Echo("Hope you're feeling better soon.");
      break;
   case -1:
      WScript.Echo("Is there anybody out there?");
      break;
}


VBScript


Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32)
Select Case BtnCode
   case 6      WScript.Echo "Glad to hear you feel alright."
   case 7      WScript.Echo "Hope you're feeling better soon."
   case -1     WScript.Echo "Is there anybody out there?"
End Select


PowerBASIC


DIM pWsh AS IWshShell
DIM BtnCode AS LONG
DIM vSecondsToWait AS VARIANT
DIM vTitle AS VARIANT
DIM vType AS VARIANT
pWsh = NEWCOM "WScript.Shell"
vSecondsToWait = 7 AS LONG
vTitle = "Answer This Question:"
vType = 4 + 32 AS LONG
BtnCode = pWsh.Popup(UCODE$("Do you feel alright?"), vSecondsToWait, vTitle, vType)
SELECT CASE BtnCode
   CASE  6 :  MSGBOX "Glad to hear you feel alright."
   CASE  7 :  MSGBOX "Hope you're feeling better soon."
   CASE -1 :  MSGBOX "Is there anybody out there?"
END SELECT