BOOL CeRunAppAtEvent(TCHAR *pwszAppName, LONG lWhichEvent);
"\\\\.\\Notofications\\NamedEvents\\Event Name"
"Event Name" is the application defined event name
lWhichEvent: Specifies the event at which the application has to be started, it can take the following values,
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. |
void RegisterApp()
{
BOOL ret;
ret = CeRunAppAtEvent(TEXT("\\Windows\\BubbleBreaker.exe"), NOTIFICATION_EVENT_WAKEUP);
if(!ret)
{
printf("RegisterApp:CeRunAppAtEvent failed, err:0x%x\r\n", GetLastError());
}
}
void UnRegisterApp()
{
BOOL ret;
ret = CeRunAppAtEvent(TEXT("\\Windows\\BubbleBreaker.exe"), NOTIFICATION_EVENT_NONE);
if(!ret)
{
printf("UnRegisterApp:CeRunAppAtEvent failed, err:0x%x\r\n", GetLastError());
}
}
Here’s a video for you folks,