Microsoft KB Archive/196068

{|
 * width="100%"|

PRB: Registry-Based Notification and Command-Line Parameters

 * }

Q196068

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows CE version 2.0 for the Handheld PC

-

SYMPTOMS
During the connection or disconnection of a Windows CE Device with the desktop, a desktop application can be executed based on the occurrence of either event. The information to make this happen is stored in the registry keys AutoStartOnConnect and AutoStartOnDisconnect, which are subkeys of the Windows CE Services key:

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services" To enable Windows CE Services to launch an application based on either event, you can create a REG_SZ value that specifies the application. Sometimes, you may want to launch an application with command-line parameters. This action may fail with a message box titled, "Application Failed to Start."

CAUSE
Windows CE Services 2.x implements the launching of an application via the ShellExecute API.

RESOLUTION
If the exe path is surrounded by quotation marks, the ShellExecute API will recognize any trailing command-line parameters instead of interpreting the entire contents as the exe path; for example:

"'c:\winnt\system32\notepad.exe' c:\test.txt"

STATUS
This behavior is by design.