R E G U S E R v1.0 DISCLAIMER: =========== This utility mucks with the registry and as such can do great harm to your NT setup if not used with care, perhaps even rendering your system unbootable. While I have made every attempt to verify the correct operation of this utility, I will not accept any responsibility for damages done to your hardware, software, or phyche as the result of using this utility or software based on this utility -- the user will accept all responsibility for any undesirable effects of this utility. Fair enough? If not, remove this utility from your system. Why So Serious? =============== The disclaimer above is so serious because the registry is to NT what our long term memory is to us. If you twiddle the wrong bits in either one, you could do serious damage. So please, becareful with this utility. What's It For? ============== As the author of PTerm, I came to a point when I decided to add the ability for PTerm to play a wav file when finished uploading or downloading. At first I was going to design a dialog box which the user could pop up to set the sounds s/he wanted played. Then one day I was in the control panel 'Sound' applet when I noticed that there were two application entries which the user could set sounds for (in addition to the system sound entries), one for MS Mail and one for Schedule+. I started thinking that it would be nice if I could add a couple of fairly generic entries in there for PTerm, one for a completed download, and one for a completed upload. I looked in the registry for where the list of sounds were kept and figured out the format. I then went looking for a small utility which I could place in a batch file to automatically add the new entries in a users registry -- there were none, at least none which I could figure out how to use. I didn't want to leave the user to starting up REGEDT32 and mucking around with that, so I wrote Reguser. Its called RegUSER because it can only be used to add/change registry values in the HKEY_CURRENT_USER tree. Operation ========= Since we have been talking about its use for PTerm, I will continue with that line of thought and use it as the example. Ok, we see that in the HKEY_CURRENT_USER tree there is a path to the sounds called: Control Panel\Sounds We would like to add a couple of values to this key, one called AppDownloadCompleted and AppUploadCompleted. The format of these values is REG_SZ, which means they are zero terminated strings. This brings up an important limitation of Reguser -- it can only add/modify values of type REG_SZ. If you try and change a value which is not REG_SZ, changes are Reguser will change the type to REG_SZ and this will cause you grief. The exact format for a sound entry is: Control Panel\Sounds\SoundValueIdentifier = sound.wav,List Entry String Lets look at an example, like the sound played when new MS Mail arrives: Control Panel\Sounds\MailBeep = ding.wav,New Mail Notification Alright, "MailBeep" is the the identifier which MS Mail will use to retrieve the sound to play when new mail arrives. "ding.wav" is what the sound is currently set to. "New Mail Notification" is the string which shows up in the list box when the control panel "Sound" applet is run. With that in mind, here are the command lines for adding the two values we need for PTerm's sound support, setting the sound to none for now: reguser "Control Panel\Sound" AppDownloadCompleted ",Download Completed" reguser "Control Panel\Sound" AppUploadComplete" ",Upload Completed" You can see that Reguser takes three parameters -- the path to the key for which a value is to be changed/added, the name of the value to add/change, and what to set the value to. Note that anytime one of the parameters needs special characters like spaces, angle brackets or commas, you must enclose the entire parameter in double quotes. After executing these two commands the user can fire up Control Panel and open the Sound applet, and s/he will see in the list of available sounds to set both "Download Completed" and "Upload Completed" which they can change from "" to be any sound on their system. If Reguser is successful in adding/changing the value it will indicate as such, otherwise it will indicate an error. Source Code =========== The source for this utility is included in RGUSRSRC.ZIP. If you make any enchancements to Reguser, please send me a copy, and try to retain backward compatibility if possible (i.e. keep the first 3 parameters the same for instance). Where Is Me? ============ I can be reached via email at: urjc!rjc@pcg.com rjc@pcg.com rjc@infograph.com roncox@inidrect.com 71722.3175@compuserve.com Feel free to email me anytime... Have fun, and for cryin' out loud, becareful! Ron Cox