CeRunAppAtEvent
A version of this page is also available for
4/8/2010
This function starts running an application or launches a named event when a specified event occurs.
Syntax
BOOL CeRunAppAtEvent(
TCHAR* pwszAppName,
LONG lWhichEvent
);
Parameters
pwszAppName
[in] Pointer to a null-terminated string that specifies the name of the application to be started.You can also use this string to support a named event instead of launching an application. The following code example shows the format that you should use for the string pointed to by pwszAppName.
"\\\\.\\Notifications\\NamedEvents\\Event Name"
Event Name represents the application-defined name of the event to signal. When you use this format for pwszAppName, the event is opened and signaled. Named events are supported in Windows CE .NET 4.0 and later.
lWhichEvent
[in] Long integer that specifies the event at which the application is to be started. It is one of the following values.Value Description NOTIFICATION_EVENT_DEVICE_CHANGE
A PC Card device changed.
NOTIFICATION_EVENT_INTERNET_PROXY_CHANGE
The Internet Proxy used by the device has changed.
NOTIFICATION_EVENT_IR_DISCOVERED
The device discovered a server by using infrared communications.
NOTIFICATION_EVENT_NET_CONNECT
The device connected to a network.
NOTIFICATION_EVENT_NET_DISCONNECT
The device disconnected from a network.
NOTIFICATION_EVENT_NONE
No events occurred. Remove all event registrations for this application.
NOTIFICATION_EVENT_OFF_AC_POWER
The user turned the alternating current (AC) power off.
NOTIFICATION_EVENT_ON_AC_POWER
The user turned the AC power on.
NOTIFICATION_EVENT_RESTORE_END
A full device data restore completed.
NOTIFICATION_EVENT_RNDIS_FN_DETECTED
RNDISFN interface is instantiated.
NOTIFICATION_EVENT_RS232_DETECTED
An RS232 connection was made.
NOTIFICATION_EVENT_SYNC_END
Data synchronization finished.
NOTIFICATION_EVENT_TIME_CHANGE
The system time changed.
NOTIFICATION_EVENT_TZ_CHANGE
The time zone changed.
NOTIFICATION_EVENT_WAKEUP
The device woke up.
Return Value
TRUE indicates success. FALSE indicates failure.
Remarks
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_EXTENDED_EVENT |
"AppRunAfterExtendedEvent" |
APP_RUN_AFTER_INTERNET_PROXY_CHANGE |
"AppRunAfterInternetProxyChange" |
APP_RUN_AFTER_SYNC |
"AppRunAfterSync" |
APP_RUN_AFTER_TZ_CHANGE |
"AppRunAfterTzChange" |
APP_RUN_AFTER_WAKEUP |
"AppRunAfterWakeup" |
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.
After you receive a notification that you have previously set, call the CeRunAppAtEvent function with your event name and the NOTIFICATION_EVENT_NONE value to clear the notification from the notification database. If you do not clear the notification, on the next call to the same event a duplicate notification may occur.
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.
Requirements
Header | notify.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 1.01 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |