In registry-based notification, an application places a command line in the desktop system registry in one of two keys. When the event specified by the key occurs, the command line is executed. Registry-based notification is appropriate for applications that do not need some control of the connection manager nor the ability to register and unregister for connection notifications.
The keys used in registry-based notification are HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect and AutoStartOnDisconnect. When a Windows CE-based device is connected to a desktop computer, the command line under AutoStartOnConnect is executed. Likewise, when the device is disconnected, the command line under AutoStartOnDisconnect is executed.
The following registry editor (.reg) file shows how to register a command line for both AutoStartOnConnect and AutoStartOnDisconnect. In this example, when the Windows CE-based device is connected, Notepad.exe is started with a command line argument of c:\config.sys. When the device is disconnected, Notepad.exe is started with a command line argument of c:\autoexec.bat.
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect]
"MicrosoftAutoConnectSample"="notepad c:\\config.sys"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnDisconnect]
"MicrosoftAutoDisconnectSample"="notepad c:\\autoexec.bat"