( Index )
Month

Brief Information about the March/April 2000 CSIG Meeting

WinStart--- List the registry startup tasks.
Sample Output

Author: Bruce Arnold


Welcome to the C++ Users Group for March/April 2000.
The Windows Registry

The Registry is a huge system defined database that applications as well as the operating system can use to store and retrieve configuration data. It has replaced the *.ini files which were so common in the Windows 3.1 days. There are about two dozen programming functions which enable you to access the Registry functions. They let you view the Registry as well as add or delete items.

This code is a small, 'command box' program called WINSTART which accesses the Registry and enumerates (ie. makes a list of) the programs that run at startup.

Many people know that Windows has one or more startup groups were they can place programs to run automatically when the computer is turned on. With Windows NT there is a startup group for each user as well as a general startup group or all users. These groups or folders can be examined with Windows Explorer. Less obvious is the fact that there are also registry settings that affect which programs start up automatically. For example there is a registry key called "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" which contains a list of programs that start automatically. This is in addition to the startup groups. Many installation programs place entries here without even telling the computer user.

The WINSTART program simply uses three of the registry functions to access this key and several others. It then provides a listing of programs which will start whenever you boot up. The program works on Windows 95, 98, NT, and 2000.


SAMPLE CODE
===========
	for (dwIndex=0; ; ++dwIndex)
	    {
	    cbName = BUFFSIZE;
	    cbData = BUFFSIZE;
 	    code2 = RegEnumValue( 
		hKey,		    // handle of key to query
		dwIndex,	    // index of subkey to enumerate
		Name,		    // address of buffer for value string
		&cbName,	    // address for size of value buffer
		NULL,		    // reserved
		&Type,		    // address of buffer for type code
		Data,		    // address of buffer for value data
		&cbData		    // address for size of data buffer
		); 
	    if (code2 != ERROR_SUCCESS) break;  // expect ERROR_NO_MORE_ITEMS

	    if (REG_SZ==Type)printf("%2d  %s =\n      %s\n\n", 
					    ++count, Name, (char *)Data);


"Random Access" questions start at 7:30 Tuesday night.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page