Guest alhabibam Posted April 28, 2005 Report Posted April 28, 2005 I want to create timers in my application that countinue working in the background even if the application is closed... Can any body help me in that?? My application should work in a way that is similar to the alarm clock application. The user should set a specific time and the application should perform some tasks when that time comes. So, I need to set timers in the background that will be triggered at the specified time.. Can any one help me and tell me how to create these timers... Any one know how to do that, please don't hesitate to answer!! Thanks.
Guest filao Posted April 29, 2005 Report Posted April 29, 2005 Not too sure about .NET CF, but I know that .NET allows you to run separate threads using the System.Threading class. You can also use the isBackground() property to set the mode of the thread.
Guest bretto Posted April 29, 2005 Report Posted April 29, 2005 (edited) I want to create timers in my application that countinue working in the background even if the application is closed... Can any body help me in that?? My application should work in a way that is similar to the alarm clock application. The user should set a specific time and the application should perform some tasks when that time comes. So, I need to set timers in the background that will be triggered at the specified time.. Can any one help me and tell me how to create these timers... Any one know how to do that, please don't hesitate to answer!! Thanks. <{POST_SNAPBACK}> As far as I know timers in your application stop working the moment your application closes. To compound the issue if your developing an application for both smartphone and pocketpc, the timers on the PPC stop working when the device goes into suspend. SP doesnt have this problem as it only turns the screen off. There is an excellent feature provided to do what you want. "CeSetUserNotificationEx" "CeClearUserNotification " Find out as much as you can about thess little babies. Here are a couple of examples that might start the ball rolling. /////////////////////////////////////////////////////////////////////////////// // Function Name: CreateTheTrigger // void CreateTheTrigger(SYSTEMTIME m_time) { CE_NOTIFICATION_TRIGGER nt; WCHAR szExeName[MAX_PATH]; TCHAR szArgs[] = TEXT("Wake up notification"); HANDLE hNotificationHandle; DWORD dwSize = sizeof(hNotificationHandle); int rc; //set up everything for the new trigger wsprintf(szExeName, _T("TheAppToRun")); // Fill in CE_NOTIFICATION_TRIGGER structure // used to create the notification event. memset (&nt, 0, sizeof (CE_NOTIFICATION_TRIGGER)); nt.dwSize = sizeof (CE_NOTIFICATION_TRIGGER); nt.dwType = CNT_TIME; nt.dwEvent = NOTIFICATION_EVENT_WAKEUP; nt.lpszApplication = szExeName; nt.lpszArguments = TEXT("anyargshere"); nt.stStartTime = m_time; hNotificationHandle = CeSetUserNotificationEx (0, &nt, NULL); //now save the returned handle incase you want to delete the trigger //maybe in a registry key return; } /////////////////////////////////////////////////////////////////////////////// // Function Name: DeleteTheTrigger // int DeleteTheTrigger(HANDLE TriggerHandle) { int rc; rc = CeClearUserNotification (TriggerHandle); return rc; } Edited April 29, 2005 by bretto
Guest bretto Posted April 29, 2005 Report Posted April 29, 2005 Sorry the code is obviously evc++ but you get the basic idea from it I hope.
Guest alhabibam Posted May 2, 2005 Report Posted May 2, 2005 Thank you guys... I have searched for "CeSetUserNotificationEx" "CeClearUserNotification " and I found some helpful resources and example, although they are very complicated, but I am working on understanding them. Thanks again..
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now