Image of Navigational Map linked to Home / Contents / Search QT on the Registry

by Dan Appleman - Desaware
Image of Line Break

Microsoft Windows 95 has many features that ease the user's workload. The key to writing a program that uses all of these features is the Registry. The Registry is a hierarchically organized central database that replaces the flat WIN.INI file. Accessing the Registry allows you to add in any of those neat new Windows 95 features, transforming your program from a quirky, obviously Visual Basic executable into a professional program that fits into the new operating system.

Have you noticed that when you boot into Windows 95, any Windows 95 aware program that was left open when you last shut down starts up right where you left it? Your program can do this as well. When you want to start your program the next time Windows starts, simply add a value to the key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

The value name is the program identifier, and the value data is a string containing the command line to be run. For example, a program might add a value named "TestApplication" with the value "C:\VB4\Programs\TestApp\Test Application.exe Document1.tst". You can add whatever command line arguments you need to restore the application to the same state it was left. The RunOnce key is cleared after all the programs listed in it have been launched, so there is no need for clean up.

The "RunOnce" key is great for continuing applications after the user has turned off the machine. But what about a program that needs to be run every time the user loads Windows, such as virus checkers? Simply enter the a value of the same format in the key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

More useful places in the Registry are found in the StorageTools manual and in numerous Microsoft documents.



Written by: Dan Appleman
March '97

Image of Arrow linked to Next Article
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]