The CeRunAppAtEvent function starts running an application when a given event occurs.
BOOL CeRunAppAtEvent(TCHAR *pwszAppName, LONG lWhichEvent);
Header file: | Notify.h |
Platforms: | H/PC |
Versions: | 1.01 and later |
If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.
The application is started with a system-defined command line. If there was already an instance of the application running, the new instance must send a private message to the existing instance and then shut down. The command line, which corresponds to the registered event, can be one of the following string constants.
Constant | Value |
---|---|
APP_RUN_AFTER_SYNC | "AppRunAfterSync" |
APP_RUN_AT_AC_POWER_ON | "AppRunAtAcPowerOn" |
APP_RUN_AT_AC_POWER_OFF | "AppRunAtAcPowerOff" |
APP_RUN_AT_NET_CONNECT | "AppRunAtNetConnect" |
APP_RUN_AT_NET_DISCONNECT | "AppRunAtNetDisconnect" |
APP_RUN_AT_DEVICE_CHANGE | "AppRunDeviceChange" |
APP_RUN_AT_IR_DISCOVERY | "AppRunAtIrDiscovery" |
APP_RUN_AT_RS232_DETECT | "AppRunAtRs232Detect" |
APP_RUN_AFTER_RESTORE | "AppRunAfterRestore" |
The string values in this table are processed as command line commands. In some cases, the part of the command line that follows the string is treated as a parameter.
Use the CeRunAppAtEvent function sparingly, because automatically starting an application can confuse the user and cause low-memory conditions on a machine with restricted memory. Ideally, the application should be small and non-intrusive.
The following constants are defined in the header file, but they are not supported:
NOTIFICATION_EVENT_ON_AC_POWER
NOTIFICATION_EVENT_OFF_AC_POWER
NOTIFICATION_EVENT_NET_CONNECT
NOTIFICATION_EVENT_NET_DISCONNECT
NOTIFICATION_EVENT_IR_DISCOVERED
When writing applications for Windows CE version 1.0, use the function PegRunAppAtEvent.