Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
RegSvr32 /s wshLtWtNonModalDialog.ocx
REGEDIT4
; This adds the ability to Right-Click on a .dll or .ocx
; and get the Register / UnRegister options.
;
; If it doesn't work for you, mail me and tell me about it.
; Jon Evans <jon@evansoft.demon.co.uk>
; ==========
; .DLL files
; ==========
[HKEY_CLASSES_ROOT\.dll]
"Content Type"="application/x-msdownload"
@="dllfile"
[HKEY_CLASSES_ROOT\dllfile]
@="Application Extension"
[HKEY_CLASSES_ROOT\dllfile\Shell\Register\command]
@="regsvr32.exe \"%1\""
[HKEY_CLASSES_ROOT\dllfile\Shell\UnRegister\command]
@="regsvr32.exe /u \"%1\""
; ==========
; .OCX files
; ==========
[HKEY_CLASSES_ROOT\.ocx]
@="ocxfile"
[HKEY_CLASSES_ROOT\ocxfile]
@="OCX"
[HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command]
@="regsvr32.exe \"%1\""
[HKEY_CLASSES_ROOT\ocxfile\Shell\UnRegister\command]
@="regsvr32.exe /u \"%1\""
; End
' demo script, to show how to use wshLtWtProgressDialog object (jw 07/15/99)
' author: jwarrington@worldnet.att.net
' --- revision history ---------------------------
' 17Jul00: revised to demo buttons (new feature)
' 18Dec00: revised to work with wshLtWtNonModalDialog.ocx,
' (and removed all the type conversions, let the variants roll)...
' --- end of revisions ---------------------------
Option Explicit
Dim oNMD : Call Instantiate(oNMD, "wshLtWtNonModalDialog.ucNMD", "oNMD_") ' as Object
' --- module level variables ---------------------
Dim m_btnStartID ' as integer
Dim m_btnCancelID ' as integer
'
Dim bCloseFlag ' t/f if user closed the form...
Dim bStartClick, bCancelClick ' as boolean
Dim iSetPoint, pctDone
Dim m_MSTitles(10), m_MSRemark(10)
Dim sIndent
'
' --- constant declarations ----------------------
Const sDlgCaption = " billy g's portfolio - [wshLtWtNonModalDialog demo]"
' --- end of declarations and constants ----------
' ================================================
' === MAIN LINE SCRIPT LOGIC =====================
' ================================================
bCloseFlag = FALSE ' set close flag as undetected.
Call SetUp_MSConstants() ' set up messages for demo...
' Create the Form, and add the controls...
Call Create_Form(sDlgCaption)
' present the introduction, and, tell the user
' we ain't gonna start until he/she clicks the start btn...
oNMD.AddLine "Welcome to the wsh Lite Weight Progress Dialog Demo,"
oNMD.AddLine " brought to you by: jawar productions. (clap, clap, clap) "
oNMD.AddLine " " ' space
oNMD.AddLine "Click the START button to begin... "
oNMD.AddLine " " ' space
' Now, wait around for the user to start the process...
bStartClick = False
Do While bStartClick = False ' wait for start button click...
WScript.Sleep 100 ' wait-a-bit (and hopefully, allow for "DoEvents")
if bCloseFlag then ' exit here...
oNMD.AddLine " => User Clicked Close [X] Button, "
WScript.Sleep 1500 ' wait-a-bit
oNMD.ShowDialog False ' clean up oNMD...
oNMD.UnloadDialog
set oNMD = Nothing
WScript.Quit ' end of script
End If
Loop ' wait loop
' starting now...
' change dual-purpose button caption...
oNMD.frmDialog.Button(1).Caption = "Cancel"
bCancelClick = False
oNMD.AddLine "Process Initiated"
oNMD.AddLine sIndent & " updating billy g's portfolio"
WScript.Sleep 400 ' allow that to "sink in" for a moment
' set point for the first milestone
iSetPoint = 10
For pctDone = 1 to 100
WScript.Sleep 100 ' adjust for loop timing (and "DoEvents")...
' check for user cancel or close...
if bCancelClick then Exit For
if bCloseFlag then Exit For
if pctDone = iSetPoint then ' periodically add messages to LstBox
oNMD.AddLine m_MSTitles(Int(iSetPoint/10))
oNMD.AddLine sIndent & m_MSRemark(Int(iSetPoint/10))
iSetPoint = iSetPoint + 10
End If
oNMD.PctComplete pctDone ' advance progbar
Next ' end of "for" loop...
' test if normal finish (neigher button clicked)...
if (bCancelClick = False) and (bCloseFlag = False) then
' is a normal finish, figure out what to do...
oNMD.AddLine "" ' space
oNMD.AddLine " ..This script is finished. Review Results, click -EXIT- to close. "
oNMD.frmDialog.Button(1).Caption = "Exit"
bCancelClick = False
Do 'wait to close...
WScript.Sleep 200
Loop Until bCancelClick
End If
' add advisory exit messages to the listbox...
oNMD.AddLine " " ' space
if bCancelClick then oNMD.AddLine " => User Clicked Cancel, "
if bCloseFlag then oNMD.AddLine " => User Clicked Close [X] Button, "
oNMD.AddLine " (This window will CLOSE in 2 secs) "
WScript.Sleep 1500 ' 1.5 sec (for slow readers, slow this down)...
oNMD.ShowDialog False ' clean up oNMD...
oNMD.UnloadDialog
set oNMD = Nothing
WScript.Quit ' end of script
' ================================================
' === SUBROUTINES FOLLOW =========================
' ================================================
' --- click event handlers ---
Sub oNMD_ButtonClick(btnID)
' MsgBox("Button Clicked, ID = " & CStr(btnID))
if btnID = m_btnStartID then bStartClick = True
if btnID = m_btnCancelID then bCancelClick = True
End Sub
Sub oNMD_UserClose()
' MsgBox(" .. user close detected")
bCloseFlag = TRUE
End Sub
' --- this code creates the form and adds the controls ---
Sub Create_Form(sCaption)
Dim wdForm, htForm, wdBtn, htBtn, wdBtnSp ' as long
Const sLBLabel = "Milestone Report"
Const sLogo = "brought to you by: jawar productions. (clap, clap, clap)... "
' do some geometry calculations...
wdForm = 460 : htForm = 320 : wdBtn = 100 : htBtn = 25
wdBtnSp = Int((wdForm - wdBtn) / 2) - 3
oNMD.CreateDialog sCaption, 80,100, wdForm,htForm
oNMD.MinMaxBtns = False ' hide the min/max buttons
oNMD.AddLabel sLBLabel, 20,10, 300,20
oNMD.AddLstBox 20,30, 400,170
oNMD.AddProgressBar 40,205, 360,20
' "dual purpose" button, start now, cancel later...
oNMD.AddButton "Start", wdBtnSp,240, wdBtn,htBtn
m_btnStartID = 101 ' the first button created has an ID of 101
m_btnCancelID = 101 ' same button...
oNMD.AddLabel sLogo, 100,275, 340,15
' --- finished with creating the form ---
With oNMD.frmDialog ' use the form object to get at control props...
.Label(2).ForeColor = &H3C14DC ' Crimson (was vbRed)
.Label(2).BackColor = &HC4E4FF ' Bisque (was vbYellow)
.Label(2).Font.Italic = True
End With
oNMD.ShowDialog True
End Sub
Sub SetUp_MSConstants() ' generate table of milestone messages...
sIndent = String(10, " ")
m_MSTitles(1) = "Launching Script... "
m_MSTitles(2) = "Milestone 1 Completed "
m_MSTitles(3) = "Milestone 2 Completed "
m_MSTitles(4) = "Milestone 3 Completed "
m_MSTitles(5) = "Milestone 4 Completed "
m_MSTitles(6) = "Milestone 5 Completed "
m_MSTitles(7) = "The GOOD News... "
m_MSTitles(8) = "The BAD News... "
m_MSTitles(9) = "Final Recommendations... "
m_MSTitles(10) = "This Script is Finished. "
m_MSRemark(1) = "Connecting to Internet (with msInternetExplorer)"
m_MSRemark(2) = "Downloading Quotes (from msInvestor)"
m_MSRemark(3) = "Updating Investment Model (using msVBA Macros)"
m_MSRemark(4) = "Evaluating Portfolio (using msExcel)"
m_MSRemark(5) = "Analyzing Results (using msVisualBasic)"
m_MSRemark(6) = "Preparing Report (using msPowerPoint)"
m_MSRemark(7) = "billy, you've done very well with your investments"
m_MSRemark(8) = "but billy, your portfolio holds just ONE STOCK"
m_MSRemark(9) = "DIVERSIFY, DIVERSIFY, DIVERSIFY... "
m_MSRemark(10)= " (Billy, contact your broker TODAY... )"
End Sub
' --- INSTANTIATE ACTX OBJECT (or class) AND CHECK ----
' (using a sub to get this ugly instantiation code out of main line code)...
Sub Instantiate (oObject, sProgramID, sEventPrefix)
Const sME = "[sub Instantiate], "
' check variant sub-type parameters...
BugAssert (VarType(sProgramID) = vbString), sME & "sProgramID must be a STRING!"
BugAssert (VarType(sEventPrefix) = vbString), sME & "sEventPrefix must be a STRING!"
On Error Resume Next ' turn on error checking
Set oObject = WScript.CreateObject(sProgramID, sEventPrefix)
BugAssert (err.number = 0), sME & "This script requires: " & sProgramID & vbCrlf _
& " kindly INSTALL and REGISTER this ActX component... "
On Error goto 0 ' turn off error checking...
End Sub
' --- BUGASSERT (yes, it's for debugging) --------
Sub BugAssert (bTest, sErrMsg)
' BugAssert is a Bruce McKinney creation.
' It is used to test for intermediate results...
if bTest then Exit Sub
MsgBox "Error Detected by BugAssert: " & vbCr & vbCr & sErrMsg, _
vbCritical, " << BugAssert FAILED >> "
WScript.Quit
End Sub