In July 2000, I needed a simple little Windows program that would allow me to display
some caller id information each time my telephone rings. I use HomeSeer
along with a VBScript that I wrote to do all the dirty work. But I still needed a separate
utility that I could call from my script that would display an image and some text.
Alex Kurz (email@example.com)
stepped up to the plate and produced PView, a nice little program that
can be launched with specific command line arguments to display an image (JPG, GIF, etc.)
or some text or both.
PView has two main advantages over VBScript's MsgBox function:
- It displays an image or text or both. MsgBox only displays text.
- Since it is an external program, it is not application modal or system modal.
After launching PView, my script continues on, even with no immediate user response.
Another great use for PView is with Windows Task Scheduler, which was introduced in Windows 98.
If you just want to schedule a simple reminder message to pop up on your screen, just schedule
the PView program to run, and give it the appropriate parameters. For example, you might want
to schedule the following alarm to go off at 12 noon every day:
"C:\Program Files\pview\PView.exe" -mc "Chow Time" -mt "Don't forget to go to lunch." -ms 64
The above command generates the following message dialog box at the schedule time:
You can download PView here for free. See the enclosed readme file
for the details on how to use the program.
PView V. 1.05|
PView -pf PictureFile -pt "Picture text" -pc "Picture Caption" -ps Text Size -pp Text Position -mt "MessageBox Text" -ms MessageBox Style -mc "MessageBox Caption"
-pf: Full qualified path and filename to a valid picture file (.jpg, .bmp, .gif, .wmf, .emf)
This Parameter enables the "show picture" part of the program. It is optional if you want to use the "MessageBox" part only.
Limitation: Only "DOS" paths are supported. If you want to show a picture in "C:\Program Files\", you must use the path "C:\Progra~1\".
-pc: Caption of the picture window.
Optional parameter. If not set, the default caption (PView) is displayed.
-pt: Text to display in the picture window.
This parameter enables the "Text in Picture Window" functionality. If used without -ps and -pp, the text will be displayed in 10p on top of the window. The text will automatically wrapped to fit into the text field.
Note: You can use the key "##CR##" anywhere in your text to force a Line Feed/Carriage Return. Example: -pt "This is one line.##CR##This is the next Line.##CR##And this is the next line."
-ps: Text size in points
A numeric expression that specifies the size of the text to display in the picture window.
-pp: Text position.
Defines the position of the text in the picture windows. Valid parameters are "top" and "bottom" (without double quotes).
-mt: Text to display in the Message Box. Must be delimited with double quotes.
This Parameter enables the "Message Box" part of the program. If used without -ms and -mc parameters, a standard Message Box with an "OK" button and no icon will appear.
-ms: Message Box Style.
A numeric expression that is the sum of values specifying the number and type of buttons to display and the icon style to use. Optional.
0 Display OK button only.
1 Display OK and Cancel buttons.
2 Display Abort, Retry, and Ignore buttons.
3 Display Yes, No, and Cancel buttons.
4 Display Yes and No buttons.
5 Display Retry and Cancel buttons.
16 Display Critical Message icon.
32 Display Warning Query icon (question mark).
48 Display Warning Message icon (exclamation mark).
64 Display Information Message icon.
-mc: Message Box Caption. The Title of the Message Box. If no -mc parameter is used, the default caption "Message" is used.
PView.exe -pf c:\somepath\somepicture.jpg -pc "This is a Test Caption"
- shows the picture "c:\somepath\somepicture.jpg" with the windows title ""This is a Test Caption"
PView.exe -pf c:\somepath\somepicture.jpg -pt "This is a message." -ps 12 -pp bottom
- shows the picture "c:\somepath\somepicture.jpg" and a text line saying "This is a message." in 12p MS Sans Serif at the bottom of the picture window.
PView.exe -mt "This is a Message. Press OK."
- comes up with a message box saying "This is a Message. Press OK." and an "OK" button.
PView.exe -pf c:\somepath\somepicture.jpg -mt "This is a Message. Press OK." -ms 65 -mc "Some Title"
- shows the picture "c:\somepath\somepicture.jpg", comes up with a message box saying "This is a Message. Press OK.", the title "Some Title" and an "OK" and a "Cancel" button.
Today I am not able to deliver a return code, so the "OK/Cancel", "Abort/Retry/Ignore" etc. buttons make no sense at all. To enable a return code I would have to compile the program as a .dll and this would make the message boxes script modal. I suggest to use the "OK" code only.
The code is generally quick and dirty and I cannot guarantee the functionality of the program. If someone finds a significant error or problem, please let me know. The same goes for suggestions and feature requests.