Rob van der Woude's Scripting Pages

Neat Dialog Boxes in COM-aware Scripting Languages

COM-visible DialogBoxes.dll

Version 0.18.1 beta

Besides as true command line tools, the dialogboxes are available in a DLL too, to allow their use in COM-aware scripting languages (e.g. VBScript, KiXtart).

Early during development, I wrote each dialog as a method (function) with lots of arguments.
Whereas in batch files I could use switches to allow skipping arguments, in the DLL's early development versions one had to supply all arguments in the exact order!
Besides, just like the command line tools, these methods were limited to returning a single string only.
So the current DLL version uses a different approach:

  1. a script creates an instance of a dialog
  2. the script sets only those properties that should not use their default values
  3. the script executes the dialog object's Show( ) method
  4. the script reads all the property values it requires

 

The following dialog boxes are available in the current version:

 

Note: The links to the source code will show only part of the DLL's entire source code.
Besides the separate dialog classes' source code, there is some shared code, which can be found near the bottom of this page.

 

💾     Download the DialogBoxes DLL

 

ColorSelectBox

Use ColorSelectBox to present either a "full features" Windows native color picker, or a really minimalistic one to select one of the available standard console colors.
For the console colors picker only, you can optionally set a timeout and the color picker's window title.
The selected color is saved as string ("selectedcolorname" and "selectedcolorRGB" properties) and as integer R, G, and B values.

Help for ColorSelectBox class

Present a color picker dialog, and return the selected color

COM ProgID: RobvanderWoude.ColorSelectBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
returnallnames Return a semi-colon list of all names matching the selected RGB value, instead of the first match only (0=false; 1=true) (ignored if consolecolorsonly equals 1) no no 0
allowcustomcolors Enable custom colors in dialog (0=false; 1=true) (ignored if consolecolorsonly equals 1) no no 1: allow
consolecolorsonly Standard 16 console colors only (0=false; 1=true) no no 1
debuginfo A log of actions for debugging N/A YES
errors List of errors with current settings N/A YES
left Offset of window from left screen border (ignored if consolecolorsonly equals 0) no no Centered (0..screenwidth - dialogwidth)
modal Modal dialog, i.e. always on top (0=false; 1=true) (ignored if consolecolorsonly equals 0) no no 1: always on top
selectedcolorB Blue component of selected color no no 0 (0..255)
selectedcolorG Green component of selected color no no 0 (0..255)
selectedcolorname Name of selected color no no Black
selectedcolorR Red component of selected color no no 0 (0..255)
selectedcolorRGB RGB values of selected color no no 0,0,0
timeout Optional dialog timeout in seconds (0=no timeout) (ignored if consolecolorsonly equals 0) no no 0: no timeout
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title (ignored if consolecolorsonly equals 0) no no Pick a Console Color
top Offset of window from top of screen (ignored if consolecolorsonly equals 0) no no Centered (0..screenheight - dialogheight)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListConSoleColors Returns a semicolon-separated list of console color name=value pairs
ListKnownColors Returns a semicolon-separated list of known color name=value pairs
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a color picker dialog based on the current property values, and if "OK" is clicked, saves the selected color name in the "selectedcolorname" property, and the RGB color values in the "selectedcolorRGB", "selectedcolorR", "selectedcolorG" and selectedcolorB" properties (if "Cancel" is clicked, the values for the default color Black are returned).
Notes: ColorSelectBox actually uses 2 different color picker dialogs:
if "consolecolorsonly" equals 0 (false), Windows' native color dialog is used, and you have a choice to allow custom colors or not;
if "consolecolorsonly" equals 1 (true), a custom, minimalistic dialog is used, with only the 16 standard console colors and nothing else, not even "OK" and "Cancel" buttons, but it does come with a timeout option.

VBScript usage example:

Set objColorSelectBox = CreateObject( "RobvanderWoude.ColorSelectBox" )

With objColorSelectBox
	.allowcustomcolors = 1
	.consolecolorsonly = 0
	.Show
	WScript.Echo .ListProperties( )
	WScript.Echo
	.consolecolorsonly = 1
	.Show
	WScript.Echo .ListProperties( )
End With

Set objColorSelectBox = Nothing

View this dialog's source code

DateTimeBox

Use DateTimeBox to select a date and/or time within the specified range and return the selected value(s) in the specified output format.
You can specify the window title, date or time only, input and output formats, and date range.
The selected date/time is saved as a property in the specified output format.

Help for DateTimeBox class

Present a dialog with date and/or time picker, and return the selected date and/or time values

COM ProgID: RobvanderWoude.DateTimeBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
culturegui The "culture" used to format date/time in the GUI no no fr-CA
culturein The "culture" used to format initial date/time no no fr-CA
cultureout The "culture" used to format output date/time no no fr-CA
dateformatgui Date format for GUI, overrides culture N/A YES short date format for culturegui
dateformatin Date format for initial date, overrides culture no no short date format for culturein
dateformatout Date format for output, overrides culture no no short date format for cultureout
dateonly Date picker only, no time picker (0=false, 1=true) no no 0: show time picker
dateseparatorgui Date separator used in the GUI N/A YES determined by culturegui
dateseparatorgui Date separator used in initial date no no determined by culturein
dateseparatorgui Date separator used in output no no determined by cultureout
debuginfo A log of actions for debugging N/A YES
earliestdate Earliest date allowed no no 1-1-0001 00:00:00 (31-12-9999 23:59:59 .. 31-12-9999 23:59:59)
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
initialdatetime Initial date/time for date/time pickers no no current date/time
latestdate Latest date allowed no no 31-12-9999 23:59:59 (1-1-0001 00:00:00 .. 31-12-9999 23:59:59)
left Offset of window from left screen border no no Centered (0..screenwidth-windowwidth)
literal Treat "prompt" as literal string (0=false; 1=true) no no 0: interpret "\t" as tab and "\n" as newline
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
maxdaysback Maximum number of days back from initial date no no -1 (you can set either earliestdate or maxdaysback, but not both)
maxdaysforward Maximum number of days forward from initial date no no -1 (you can set either latestdate or maxdaysback, but not both)
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
prompt Optional text above controls no no
selecteddate Date selected in date picker N/A YES
selectedtime Time selected in time picker N/A YES
selectedweek Week of year for selected date N/A YES
selectedweekday Day of week for selected date N/A YES
timeformatgui Time format for GUI, overrides culture N/A YES long time format for culturegui
timeformatin Time format for initial time, overrides culture no no long time format for culturein
timeformatout Time format for output, overrides culture no no long time format for cultureout
timeonly Time picker only, no date picker (0=false, 1=true) no no 0: show date picker
timeout Optional dialog timeout in seconds (0=no timeout) no no 0: no timeout
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
timeseparatorgui Time separator used in the GUI N/A YES determined by culturegui
timeseparatorin Time separator used in initial date no no determined by culturein
timeseparatorout Time separator used in output no no determined by cultureout
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
top Offset of window from top of screen no no Centered (0..screenheight-windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 135 (135..screenheight)
windowwidth Width of dialog window no no 220 (220..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListInstalledFontFamilyNames Returns a semi-colon separated list of installed font family names
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a date/time picker dialog based on the current property values, and if "OK" is clicked, saves the last selected date and time in the "selecteddate" and "selectedtime" properties (if "Cancel" is clicked, "selecteddate" and "selectedtime" are set to empty strings).
Notes: Date and time format settings for input and output take precedence over culture derived date and time formats. Date and time formats for the date and time pickers are read-only.
If the current culture of the local computer does not use AM/PM designators, no AM/PM designators can be shown in the date and Time Pickers, regardless of selected GUI culture.
Earliest date, initial date/time and latest date are each automatically constricted to their valid ranges if you try to set them to a value outside their ranges: earliest date is limited to the earliest possible date (0001-01-01) to the current latest date range, initial date/time is limited to the current earliest to latest date range, and latest date is limited to the current earliest date to the latest possible date (9999-12-31). Maximum values for left, top, windowheight and windowwidth are all limited to make sure the window will fit in the screen's working area, taking into account the size and orientation of the taskbar, and the size of the window's own borders and title bar.

VBScript usage example:

Set objDateTimeBox = CreateObject( "RobvanderWoude.DateTimeBox" )

With objDateTimeBox
	.top     = 200
	.left    = 300
	.timeout = 15
	.title   = "Pick a Date and Time"
	.Show
	WScript.Echo "Selected date and time: " & .selecteddate & " " & .selectedtime
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objDateTimeBox = Nothing

View this dialog's source code

Use DropDownBox to present a list of choices, and return the selected one; like CHOICE with a GUI.
You must enter a list of choices, separated by a delimiter. You can optionally add a prompt, set the window title, preselected item, and window dimensions, change the delimiter, and more.
The selected text is saved as a property.

Help for DropDownBox class

Present a dropdown list of choices, and return the selected value

COM ProgID: RobvanderWoude.DropDownBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
debuginfo A log of actions for debugging N/A YES
defaultindex Index of initially selected item in dropdown no no -1: none selected
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
left Offset of window from left screen border no no Centered (0..screenwidth-windowwidth)
list Semicolon-separated list of items for dropdown * YES no * Set either "list" or "listfile" property
listfile Path to file containing list no
literal Treat "prompt" as literal string (0=false; 1=true) no no 0: interpret "\t" as tab and "\n" as newline
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
prompt Optional text above controls no no No prompt
selectedindex Index of last selected dropdown item N/A YES
selecteditem Text of last selected dropdown item N/A YES
timeout Optional dialog timeout in seconds (0=no timeout) no no 0: no timeout
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
top Offset of window from top of screen no no Centered (0..screenheight-windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 90 (90..screenheight)
windowwidth Width of dialog window no no 200 (200..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a dropdown dialog box based on the current property values, and if "OK" is clicked, saves the last selected item's index in "selectedindex" property, and its text value in "selecteditem" property (if "Cancel" is clicked, "selectedindex" is set to -1 and "selecteditem" to an empty string). Either "list" or "listfile" property must be set

VBScript usage example:

Set objDropDownBox = CreateObject( "RobvanderWoude.DropDownBox" )

With objDropDownBox
	.list         = "Amsterdam;London;Paris;Tokyo"
	.defaultindex = 1
	.prompt       = "Choose a destination"
	.title        = "Destination"
	.top          = 200
	.left         = 300
	.Show
	WScript.Echo "Your selected destination is " & .selecteditem
End With

Set objDropDownBox = Nothing

View this dialog's source code

FontSelectBox

Use FontSelectBox to present a font selection dialog.
You can optionally enable several "bells and whistles" like color selection, effects (strikeout and underline) and charactersets.
Several property values for the selected font are saved as properties.

Help for FontSelectBox class

Present a font dialog, and return the selected font

COM ProgID: RobvanderWoude.FontSelectBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
choosecharset Allow alternative character sets (0=false; 1=true) no no 1: allow
debuginfo A log of actions for debugging N/A YES
errors List of errors with current settings N/A YES
fixedpitchonly Allow only monospaced fonts (0=false; 1=true) no no 0: allow proportional fonts as well
fontcharset Font character set used in dialog no no ANSI
fontcolorB Blue component of font color no no 0
fontcolorG Green component of font color no no 0
fontcolorname Name of font color no no Black
fontcolorR Red component of font color no no 0
fontcolorRGB RGB values of font color no no 0,0,0
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..64)
fontstyle Font stylee used in dialog no no Regular (Bold, Italic, StrikeOut, UnderLine)
maximumfontsize Maximum font size allowed in dialog no no 64
minimumfontsize Minimum font size allowed in dialog no no 6
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
scriptsonly Disable non-OEM & symbol fonts (0=false; 1=true) no no 0: allow all
showcolor Allow color choice in dialog (0=false; 1=true) (requires showeffects = 1) no no 1: allow
showeffects Allow underline, strikethrough (0=false; 1=true) no no 1: allow
vectorfonts Allow vector fonts in the dialog (0=false; 1=true) no no 1: allow
Version Show this DLL's version N/A YES
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListColors Returns a semicolon-separated list of all available color names
ListFontCharSets Returns a semicolon-separated list of available font character sets
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a font dialog based on the current property values, and if "OK" is clicked, saves the selected font properties in the "fontfamily", "fontsize", "fontstyle", "fontcharset", "fontcolorname", "fontcolorRGB", "fontcolorR", "fontcolorG" and "fontcolorB" properties (if "Cancel" is clicked, the default font and properties are selected).

VBScript usage example:

Set objFontSelectBox = CreateObject( "RobvanderWoude.FontSelectBox" )

With objFontSelectBox
	.Show
	WScript.Echo .ListProperties( )
End With

Set objFontSelectBox = Nothing

View this dialog's source code

InputBox

InputBox was first built using the .NET FrameWork's Interaction.InputBox Method, but I found it too ugly.
A dynamically created Windows Form allowed me more freedom in design.
A large part of the C# code for InputBox comes from Gorkem Gencay on StackOverflow.com.
You can specify the "prompt" text, the window title, the default value (already entered in the input text field, option not available for masked password input), an optional timeout in seconds, and the dialog box width and height, disable filtering of "risky" characters & < > | and ", add regular expression based filtering and/or an input mask (input text template), whether or not to hide (mask) the input text (for password input) and whether or not to insert a "Show password" checkbox.
When the "OK" button is clicked, the entered text is saved as a property.
If the dialog times out and a default text was specified, that default text is saved.

Help for InputBox class

Present a prompt for input dialog, and return the text entered

COM ProgID: RobvanderWoude.InputBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
allowshowpassword Add "Show password" checkbox (0=false; 1=true) no no 0: no checkbox
asciionly Allow only ASCII characters (0=false; 1=true) no no 0: allow all
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
captionshowpassword Text for "Show password" checkbox no no Show password
debuginfo A log of actions for debugging N/A YES
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
hidepassword Hide input, for password dialogs (0=false; 1=true) no no 0: show input
initialinput Initial input (e.g. expected value) no no
input Input as typed in text field no no
left Offset of window from left screen border no no Centered (0..screenwidth-windowwidth)
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
mask Optional mask to apply to input no no
maskedinput Masked input, i.e. including mask literals no no
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
passwordchar Character used to hide input no no *
prompt Optional text above controls no no Prompt
regexcasesensitive Case sensitive regexes (0=false; 1=true) no no 1: case sensitive
regexendresult Regex pattern applied to submitted input no no .*
regexonthefly Regex pattern applied at eacht change of input no no .*
showpassword "Show password" checkbox status (1=checked) no no 0: not checked
timeout Optional dialog timeout in seconds (0=no timeout) no no 0
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title no no Title
top Offset of window from top of screen no no Centered (0..screenheight-windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 110 (110..screenheight)
windowwidth Width of dialog window no no 200 (200..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
MaskLanguageTable Returns a table with an overview of the MaskedTextBox's masking language
SampleCode Returns VBScript sample code for this dialog
Show Presents a prompt for input dialog based on the current property values, and if "OK" is clicked, saves the entered input in the "input" property. If "mask" is specified, a masked textbox will be used, and if the entered text complies to the mask, it will be saved unmasked (without the mask literals) in the "input" property and masked (including mask literals) in the "maskedinput" property. If "Cancel" is clicked, or if the entered input does not comply to the mask or does not match the regular expressions, "input" and "maskedinput" will both be empty.

VBScript usage example:

Set objInputBox = CreateObject( "RobvanderWoude.InputBox" )

With objInputBox
	.prompt = "Enter a MAC address"
	.title = "MAC Address"
	.initialinput = "0022446688AACCEE"
	.mask = ">CC\:CC\:CC\:CC\:CC\:CC\:CC\:CC"
	.regexendresult = "[\dA - F]{16}"
	.regexonthefly = "[\dA-F]{0,16}"
	.regexcasesensitive = 0
	.timeout = 120
	.Show
	WScript.Echo "New MAC address: " & .input & " (" & .maskedinput & ")"
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objInputBox = Nothing

If you intend to use an input mask, use dialog's MaskLanguageTable( ) method to show detailed help for the mask "language".

View this dialog's source code

MessageBox

MessageBoxdoes what its name suggests: it shows a simple message in a popup window.
Like its VBScript counterpart it returns the "answer", i.e. a code for the button that was clicked.
But unlike its VBScript counterpart, the answer isn't returned as an integer, but as a string, i.e. the (English, lower case) caption of the button that was clicked.
You can specify the message text, the window title, the buttons and icon, the default button, even right alignment or rigt-to-left reading, and an optional timeout.

Help for MessageBox class

Present a message dialog, and return the caption of the button clicked

COM ProgID: RobvanderWoude.MessageBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
buttons The buttons presented in the dialog no no OK (OK, OKCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel)
buttonclicked The caption of the button that was clicked no no
defaultbutton The button that has focus when the dialog opens no no Button1 (Button1, Button2, Button3)
debuginfo A log of actions for debugging N/A YES
errors List of errors with current settings N/A YES
icons The icon in the dialog no no None (None, Hand, Error, Stop, Question, Exclamation, Warning, Asterisk, Information)
message The message to be displayed in the dialog no no
options The options for the dialog no no DefaultDesktopOnly, ServiceNotification (DefaultDesktopOnly, RightAlign, RtlReading, ServiceNotification)
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
Version Show this DLL's version N/A YES
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListMessageBoxButtons Return a semicolon-separated list of available buttons
ListMessageBoxIcons Return a semicolon-separated list of available icons
ListMessageBoxOptions Return a semicolon-separated list of available options
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a message dialog based on the current property values, and saves the caption of the button that is clicked in the "buttonclicked" property.

VBScript usage example:

Set objMessageBox = CreateObject( "RobvanderWoude.MessageBox" )

With objMessageBox
	.message = "This MessageBox is more or less obsolete in VBScript," & vbCrLf _
	         & "as it is almost identical to VBScript's own MsgBox," & vbCrLf _
	         & "but it may be useful in other COM-aware scripting languages."
	.title = "MessageBox Demo"
	.buttons = "OK"
	.icon = "Information"
	.Show
	WScript.Echo "You clicked: " & .buttonclicked
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objMessageBox = Nothing

MessageBox.exe is built using the .NET FrameWork's MessageBox Class.

View this dialog's source code

MultipleChoiceBox

Use MultipleChoiceBox to present a list of choices grouped as checkboxess, and return the selected items; derived from RadioButtonBox, but allowing multiple choices, hence its name.
You must enter a list of choices, separated by a delimiter. You can optionally add a prompt, set the window title, preselected items, and window layout, or change the delimiter.
The selected items are saved in a semicolon-delimited string.

Help for MultipleChoiceBox class

Present a dialog with a group of checkboxes, and return the selected items

COM ProgID: RobvanderWoude.MultipleChoiceBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
columns The number of columns no no
debuginfo A log of actions for debugging N/A YES
defaultindex The index of the preselected item in the list no no
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
left Offset of window from left screen border no no Centered (0..screenwidth-windowwidth)
list Semicolon-separated list of items * YES no * Set either "list" or "listfile" property
listfile Path to file containing list no
literal Treat "prompt" as literal string (0=false; 1=true) no no 0: interpret "\t" as tab and "\n" as newline
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
prompt Optional text above controls no no No prompt
selectedindex Index of last selected radio button item N/A YES
selecteditem Text of last selected radio button item N/A YES
timeout Optional dialog timeout in seconds (0=no timeout) no no 0: no timeout
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
top Offset of window from top of screen no no Centered (0..screenheight-windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 90 (90..screenheight)
windowwidth Width of dialog window no no 200 (200..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a dialog with a group of radio buttons based on the current property values, and saves the text for the selected item in the "selecteditem" property, and its index (in list) in the "selectedindex" property. Either "list" or "listfile" property must be set

VBScript usage example:

Set objMultipleChoiceBox = CreateObject( "RobvanderWoude.MultipleChoiceBox" )

With objMultipleChoiceBox
	.list        = "Bungeejump from helicopter;Firewalk;Paraglide into an active volcan"
	.preselected = "0;1;2"
	.prompt      = "15 seconds to pick your favorites:"
	.title       = "My Bucket List"
	.top         = 200
	.left        = 300
	.timeout     = 15
	.Show
	WScript.Echo "Selected bucket list items: " & .selecteditems
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objMultipleChoiceBox = Nothing

View this dialog's source code

OpenFileBox

Use OpenFileBox to select an existing file.
You can specify the required file type, the start folder, and the window title.
The full path to the selected file is saved as a property.

Help for OpenFileBox class

Present an Open File dialog, and return the selected file path

COM ProgID: RobvanderWoude.OpenFileBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
addallfiles Add "All files (*.*)" to filter (0=false; 1=true) no no 1
addextension Add extension if user forgot it (0=false; 1=true) no no 1
debuginfo A log of actions for debugging N/A YES
defaultextension Default extension to be added no no
errors List of errors with current settings N/A YES
filter File filter no no All files (*.*)|*.*
multidotted Allow multiple extensions (0=false; 1=true) no no 1
multiselect Allow selecting multiple files (0=false; 1=true) no no 0
readonlychecked Checkbox read-only is checked (0=false; 1=true) no no 0
selectedfile The path of the selected file(s) N/A YES
showreadonly Show checkbox to open read-only (0=false; 1=true) no no 0
startfolder The initial folder for the dialog no no
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents an Open File dialog based on the current property values, and if "OK"is clicked, saves the selected file path in the "selectedfile" property (if "Cancel" is clicked, "selectedfile" will be empty).
Notes: Though the name may suggest otherwise, this dialog does NOT actually open the selected file, it merely returns the selected file's path.
A similar warning goes for the read-only checkbox: it doesn't actually DO anything, but you can use it to allow the user a choice for the actions based on this dialog's result.

VBScript usage example:

Set objOpenFileBox = CreateObject( "RobvanderWoude.OpenFileBox" )

With objOpenFileBox
	.startfolder = "D:\"
	.Show
	WScript.Echo "Selected file: " & .selectedfile
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objOpenFileBox = Nothing

OpenFileBox.exe was built using the .NET FrameWork's OpenFileDialog Class, which implies that it can be used to manipulate files and folders.
Always use permissions to manage user access to files and folders.

View this dialog's source code

OpenFolderBox

Use OpenFolderBox to select an existing folder.
You can specify the start folder, the description above the tree view, and whether or not to hide the "Make New Folder" button.
The full path to the selected folder is saved as a property.

Help for OpenFolderBox class

Present a Browse Folder dialog, and return the selected folder path

COM ProgID: RobvanderWoude.OpenFolderBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
allowmakedir Show "Make New Folder" button (0=false; 1=true) no no 0: don't show
debuginfo A log of actions for debugging N/A YES
description Text above directory tree in dialog no no
errors List of errors with current settings N/A YES
rootfolderfolder Windows Special Folder that is used as the directory tree root no no MyComputer (use the "ListSpecialFolders" method to get a list of valid names)
selectedfolder The path of the selected folder N/A YES
startfolder The initial folder for the dialog no no D:\Users\Rob\Documents
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListSpecialFolders Returns a semicolon-separated list of Windows Special Folders
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a Browse Folder dialog based on the current property values, and if "OK"is clicked, saves the selected folder path in the "selectedfolder" property (if "Cancel" is clicked, the startfolder is assumed selected).

VBScript usage example:

Set objOpenFolderBox = CreateObject( "RobvanderWoude.OpenFolderBox" )

With objOpenFolderBox
	.rootfolder = "MyDocuments"
	.Show
	WScript.Echo "Selected folder: " & .selectedfolder
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objOpenFolderBox = Nothing

OpenFolderBox.exe was built using the .NET FrameWork's FolderBrowserDialog Class, which implies that it can be used to manipulate folders, even with the "Make New Folder" button hidden (try Shift+F10 or right-click).
Always use permissions to manage user access to (files and) folders.

View this dialog's source code

PrinterSelectBox

Use PrinterSelectBox to select an installed printer.
You can specify the window title, the preselected printer (either by its full name or with a regular expression), and the dialog box width.
The name of the selected printer is saved as a property.
The original version used Windows' own Print dialog from the .NET FrameWork's PrintDialog Class, which has a lot of features we won't need in this utility.
The current version has a more "Spartan" interface without the bells and whistles that didn't work in the old version.

Help for PrinterSelectBox class

Present a basic print dialog, and return the selected printer name

COM ProgID: RobvanderWoude.PrinterSelectBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
debuginfo A log of actions for debugging N/A YES
defaultprinter The current default printer name N/A YES
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
left Offset of window from left screen border no no Centered (0..screen width - windowwidth)
literal Treat "prompt" as literal string (0=false; 1=true) no no 0: interpret "\t" as tab and "\n" as newline
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
preselected The initially preselected printer no no default printer or first in list
printercategory Show only printers from this category no no All (All, Local, Network, Physical, Virtual)
selectedprinter The printer that was selected when the "OK" button was clicked or timeout elapsed; if "Cancel" was clicked, selectedprinter is the default printer N/A YES
timeout Optional dialog timeout in seconds (0=no timeout) no no 0
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
top Offset of window from top of screen no no Centered (0..screen height - windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 220 (220..screenheight)
windowwidth Width of dialog window no no 400 (400..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListAllPrinters Returns as list of all printers
ListCategories Returns as list of available printer categories
ListCategory Returns as list of all printers in the selected category
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a basic print dialog based on the current property values, and if "OK" is clicked, saves last selected printer name in the "selectedprinter" property (if "Cancel" is clicked, "selectedprinter" is default printer).

VBScript usage example:

Set objPrinterSelectBox = CreateObject( "RobvanderWoude.PrinterSelectBox" )

With objPrinterSelectBox
	.printercategory = "Physical"
	.top             = 200
	.left            = 300
	.timeout         = 15
	.title           = "Select a Physical Printer"
	WScript.Echo
	WScript.Echo "Printers to choose from:"
	WScript.Echo "========================"
	WScript.Echo .ListCategory( )
	WScript.Echo
	.Show
	WScript.Echo "Selected printer: " & .selectedprinter
	WScript.Echo
	WScript.Echo "Default printer:  " & .defaultprinter
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objPrinterSelectBox = Nothing

View this dialog's source code

RadioButtonBox

Use RadioButtonBox to present a list of choices grouped as radio buttons, and return the selected one; equivalent to DropDownBox with radio buttons instead of a dropdown list.
You must enter a list of choices, separated by a delimiter. You can optionally add a prompt, set the window title, preselected item, and window dimensions, change the delimiter, and choose if you want the selected index to be returned as "ErrorLevel".
The selected text is saved as a property.

Help for RadioButtonBox class

Present a dialog with a group of radio buttons, and return the text for the selected item

COM ProgID: RobvanderWoude.RadioButtonBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
captioncancel Caption for "Cancel" button no no Cancel
captionok Caption for "OK" button no no OK
columns The number of columns no no
debuginfo A log of actions for debugging N/A YES
defaultindex The index of the preselected item in the list no no
errors List of errors with current settings N/A YES
fontfamily Font family used in dialog no no Microsoft Sans Serif
fontsize Font size used in dialog no no 10 (6..48)
left Offset of window from left screen border no no Centered (0..screenwidth-windowwidth)
list Semicolon-separated list of items * YES no * Set either "list" or "listfile" property
listfile Path to file containing list no
literal Treat "prompt" as literal string (0=false; 1=true) no no 0: interpret "\t" as tab and "\n" as newline
localizecaptions Use localized button captions (0=false; 1=true) no no 0: English captions
modal Modal dialog, i.e. always on top (0=false; 1=true) no no 1: always on top
prompt Optional text above controls no no No prompt
selectedindex Index of last selected radio button item N/A YES
selecteditem Text of last selected radio button item N/A YES
timeout Optional dialog timeout in seconds (0=no timeout) no no 0: no timeout
timeoutelapsed Timeout elapsed status (0=false; 1=true) N/A YES
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
top Offset of window from top of screen no no Centered (0..screenheight-windowheight)
Version Show this DLL's version N/A YES
windowheight Height of dialog window no no 90 (90..screenheight)
windowwidth Width of dialog window no no 200 (200..screenwidth)
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents a dialog with a group of radio buttons based on the current property values, and saves the text for the selected item in the "selecteditem" property, and its index (in list) in the "selectedindex" property. Either "list" or "listfile" property must be set

VBScript usage example:

Set objRadioButtonBox = CreateObject( "RobvanderWoude.RadioButtonBox" )

With objRadioButtonBox
	.list         = "Arizona;Texas;California;Washington;Montana;Utah"
	.defaultindex = 4
	.prompt       = "You have 15 seconds to select a state"
	.top          = 200
	.left         = 300
	.timeout      = 15
	.Show
	WScript.Echo "Selected state: " & .selecteditem
End With

Set objRadioButtonBox = Nothing

View this dialog's source code

SaveFileBox

Use SaveFileBox to select a target file to save to, existing or not.
Besides the required file type, start folder, and window title, you can also specify the behaviour when the selected file already exists, or when the specified file does not exist.
The full path to the selected file, existing or not, is saved as a property.

Help for SaveFileBox class

Present a Save File dialog, and return the selected file path

COM ProgID: RobvanderWoude.SaveFileBox

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
addallfiles Add "All files (*.*)" to filter (0=false; 1=true) no no 1
addextension Add extension if user forgot it (0=false; 1=true) no no 1
debuginfo A log of actions for debugging N/A YES
defaultextension Default extension to be added no no
description Text above directory tree no no
errors List of errors with current settings N/A YES
filter File filter no no "All files (*.*)|*.*"
forceext Append default extension if missing no no
multidotted Allow multiple extensions (0=false; 1=true) no no 1
overwrite Overwrite file if it exists (0=false; 1=true) no no 0
selectedfile The path of the selected file(s) N/A YES
startfolder The initial folder for the dialog no no
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
verbose Prompt if file does not exist (0=false; 1=true) no no 0
Version Show this DLL's version N/A YES
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
SampleCode Returns VBScript sample code for this dialog
Show Presents an Open File dialog based on the current property values, and if "OK"is clicked, saves the selected file path in the "selectedfile" property (if "Cancel" is clicked, "selectedfile" will be empty)

VBScript usage example:

Set objSaveFileBox = CreateObject( "RobvanderWoude.SaveFileBox" )

With objSaveFileBox
	.startfolder = "D:\"
	.Show
	WScript.Echo "Selected target file: " & .selectedfile
	WScript.Echo
	WScript.Echo .ListProperties( )
End With

Set objSaveFileBox = Nothing

SaveFileBox.exe was built using the .NET FrameWork's SaveFileDialog Class, which implies that it can be used to manipulate files and folders.

View this dialog's source code

SystemTrayMessage

Unlike the previous dialog boxes, SystemTrayMessage displays a tooltip message in the system tray's notification area.
By default it starts displaying a tooltip which will be visible for 10 seconds (or any timeout specified), or until the icon or tooltip balloon is clicked.
With the "wait" property set to 0 (false) the program will terminate immediately after starting the tooltip, but there will be no status update of the "balloonclicked" property. The icon will remain in the notification area after the timeout elapsed, until the mouse pointer hovers over it.

Help for SystemTrayMessage class

Present an icon in the notification area (system tray) with an optional tooltip balloon, and return whether the icon or tooltip were clicked

COM ProgID: RobvanderWoude.SystemTrayMessage

Properties (Note that all properties are string or integer, no booleans, objects or arrays)
Property Name Description Mandatory Read-Only Default (Allowed) Values
balloonclicked Will be 1 (true) if wait is 1 (true) and the tooltip balloon was clicked before timeout elapsed (0=false; 1=true) N/A YES
debuginfo A log of actions for debugging N/A YES
errors List of errors with current settings N/A YES
escapemessage Interpret \n as newline and \t as tab in message (0=false; 1=true) no no 1
iconfile Either an icon file (*.ico) or an icon library (*.dll or *.exe) containing the icon to be used in notification area no no icon #277 in shell32.dll
iconindex Index of icon in icon library iconfile no no 277 if iconfile is shell32.dll
message Tooltip message (if empty, no tooltip is shown) no no
timeout Optional dialog timeout in seconds (0=no timeout) no no 10
title Dialog window title no no DialogBoxes.dll, Version 0.19.0.0
tooltipicon Icon shown in the tooltip balloon (use ListToolTipIcons( ) for a list of available icons) no no Info (None, Info, Warning, Error))
Version Show this DLL's version N/A YES
wait Wait for timeout to elapse (0=false; 1=true) (if 1, script will wait until either tooltip balloon is clicked or timeout elapses, if 0 script will continue without waiting, but "balloonclicked" status will not be available) 1
Methods
Method Name Description Requirements
CheckUpdate Check the developer's website for updates
Credits Shows credits
Help Returns this help text as plain text, or if optional parameter equals 1, as html
ListProperties Returns a list of this class' properties as key=value pairs (1 per line)
ListToolTipIcons Return a semicolon-separated list of available icons
SampleCode Returns VBScript sample code for this dialog
Show Presents an icon in the notification area (system tray) with an optional tooltip balloon; if the program is set to continue without waiting, then that's all; if the program is set to wait for the timeout to elapse, clicking the tooltip balloon sets "balloonclicked" property and aborts the program.

VBScript usage example:

Set objSystemTrayMessage = CreateObject( "RobvanderWoude.SystemTrayMessage" )

With objSystemTrayMessage
	.message = "It is time for your daily backup." & vbCrLf & "Please save and close all documents," & vbCrLf & "and click this message when ready."
	.title = "Backup Time"
	.timeout = 1800
	.wait = 1
	WScript.Echo .ListProperties( )
	WScript.Echo
	.Show
	If .balloonclicked Then
		WScript.Echo "You clicked the tooltip balloon before the timeout elapsed"
	End If
End With

Set objSystemTrayMessage = Nothing

SystemTrayMessage screenshot

View this dialog's source code

Classic Dialogs, or "Wrappers"

Besides the dialog classes, each dialog also comes as a method (function) in the RobvanderWoude.DialogBoxes "wrapper" object.
The "wrapper" methods use only a subset of a dialog's available properties, and can return only one single propertey, whereas for the dialog classes all properties are available, before as well as after showing the dialog.

View the "classic" dialogs' source code

Shared Code

Each dialog has its own code file, but also uses some shared code.

View the dialogs' shared source code

 

Credits

Building COM Objects in C# by Mubbasher Adeel:
https://www.codeproject.com/Articles/7859/Building-COM-Objects-in-C

On-the-fly forms by Gorkem Gencay on StackOverflow.com:
http://stackoverflow.com/questions/97097#17546909

Localize captions by Martin Stoeckli:
http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources

Extract icons from Shell32.dll by Thomas Levesque on StackOverflow.com:
http://stackoverflow.com/questions/6873026

Get ISO week of year by "il_guru" on StackOverflow.com:
https://stackoverflow.com/a/11155102

Check if a font is a fixed pitch font, tip from Hans Passant on StackOverflow.com:
https://stackoverflow.com/q/21965321

Extension method to limit number to range by "dtb" on StackOverflow.com:
https://stackoverflow.com/a/3176628

Mask language table by Microsoft:
http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx

And last but not least, thanks for Wolfgang Struensee, for testing the many pre-release versions of this DLL

 

Thanks!!

 

💾     Download the DialogBoxes DLL

 

For use in batch files, check the separate dialog batch tools.

 


page last modified: 2022-10-23; loaded in 0.0080 seconds