View Full Version : create a window with a message in it
josh48315
07-10-2008, 01:35 AM
how do i create a simple windows window with my own personal message in it so that when my roommate comes in to get on my computer i can tell him any useful information, and then he just clicks the OK button? do i just do this through command prompt?
i know that when there are multiple users on one computer, you can go to user accounts and message another user so that when they log on they are shown a window with the message. i want to do something like this but since this is my computer and i am the account on it, i want to be able to just make a window for the few times i know someone will be on it later.
thanks!
Paul Komski
07-10-2008, 03:21 AM
You could use Tom Revell's Stickies (http://www.zhornsoftware.co.uk/stickies/) or other virtual PostIt notes. I think they are fantastic.
You could write a text or html file and set it into an active desktop.
You could write anything as a document and put a shortcut to it in the Startup Folder.
... and many other ways ... including windows messenger and email and even vbscripts that will create popup boxes (as long as scripting is not disabled or blocked by a firewall) - usually triggered by a shortcut or a Scheduled Task or a Batch File run from Startup.
The simplest vb windows dialog box with a message would follow the format of:
msgbox "Hi Pal - Here's my message"
Just write that as one line in notepad and save it with a .vbs file extension. How you trigger it is up to you.
josh48315
07-10-2008, 12:09 PM
cool, thanks. how do i make it so that the window is the dominant window, meaning it must be clicked OK before you can do anything else, that way the person is forced to go to it and have a better chance of reading it?
josh48315
07-10-2008, 01:09 PM
oh yeah and one more thing, how do i make it so that it has a title in the upper box? so it has a title then my message?
Paul Komski
07-10-2008, 01:29 PM
Try
msgbox "Click OK to make this message dissappear", vbSystemModal + vbExclamation, "Read Message in this Window"
You can also use Stickies and Right Click on one and set the "Always on Top" Option.
More vbs options for msgbox at http://www.w3schools.com/VBScript/func_msgbox.asp but note that vbSystemModal doesnt freeze everything else using vbs in WinXP but it should keep it "on top" until clicked. Unless of course something else is run with a keep on top specification.
josh48315
07-10-2008, 01:51 PM
cool! thanks again. now how do i make it the dominant window, so that you can't click on anything else or bring up anything else without clicking the OK button first?
Paul Komski
07-10-2008, 02:08 PM
so that you can't click on anything else or bring up anything else without clicking the OK button first?
I don't know how to do that under Windows XP using VB or VBS or VBA. It would probably entail using .NET or a Win32 API and I don't have time to research that at the moment. Sorry.
josh48315
07-10-2008, 02:12 PM
that's fine thanks for all of your help. if you do figure out how to do the dominant window thing then please let me know.
thanks again for all of your help! you are the man.
Paul Komski
07-11-2008, 04:36 AM
Even using Win32 APIs (http://delphi.about.com/od/windowsshellapi/a/notactive_modal.htm) one can't get that much more attention-grabbing than making that Window the Topmost one.
SystemModal rather than ApplicationModal sounds like the whole system must wait till OK is clicked but the only real difference between the two is that the application (here just a simple vb script) must wait till OK is clicked but when it is set to system the message should remain visible when something else is made active.
Here's a little routine that should grab the person logging-on's attention.
Create a text file with your message called attention.txt and put it in the C: drive.
Create a batch file called attention.bat and put it also in the C: drive
Setup a Scheduled Task to run at logon and point it at attention.bat
The batch file's text should be:
:TOP
start C:\attention.txt
sleep 5
GOTO TOP
Now when logging-on a command prompt should show followed by the text file. The text file will keep reappearing on top every 5 seconds until the command prompt window is closed.
You can add another line to play a continuous sound before the sleep 5 line to get even more attention. For example:
:TOP
start C:\attention.txt
start mplay32.exe /play /close C:\A_SOUND.WAV
sleep 5
GOTO TOP
Alter paths filenames timing etc to suit. The same basics can be used as an alarm call by setting the scheduled task to run everyday at a certain time.
You can always test a Scheduled Task by right clicking on it and choosing run.
vBulletin v3.6.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.