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. That is, 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.
Registry-based notification is appropriate for applications that need neither some control of the connection manager nor the ability to register and deregister for connection notifications.
To register an application for automatic executionIt should include a company and product name — for example, MicrosoftHPCExplorerAutoConnect. Enter the named value under the appropriate key, either AutoStartOnConnect or AutoStartOnDisconnect.
The following registry editor (.reg) file shows how to register a command line for both AutoStartOnConnect and AutoStartOnDisconnect. In this example, when the 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"