The function CeRunAppAtEvent allows a program to be run when one of the following events occur:
Listing 7.4 shows a call to CeRunAppAtEvent that sets Notify.exe to run when ActiveSync synchronization completes. Listing 7.4 Runs application on an eventvoid Listing7_4() { if(!CeRunAppAtEvent(_T("\\Notify.exe"), NOTIFICATION_EVENT_SYNC_END)) cout _T("Cannot set application to run") endl; else cout _T("Notify.exe will run when sync finishes") endl; } The application will be run with a command line string whose value depends on the event being used, and these strings as shown in Table 7.1.
The application specified in CeRunAppAtEvent will be run each time the specified event occurs. All events associated with an application can be removed by calling the function CeRunAppAtEvent with NOTIFICATION_EVENT_NONE as the last parameter (Listing 7.5). Listing 7.5 Removes an application eventvoid Listing7_5() { if(!CeRunAppAtEvent(_T("\\Notify.exe"), NOTIFICATION_EVENT_NONE)) cout _T("Cannot stop application event.") endl; else cout _T("Application event removed.") endl; }
|