BOOL CMyWinApp::OnIdle(LONG lCount) { // In this example, as in most applications, you should let the // base class CWinApp::OnIdle complete its processing before you // attempt any additional idle loop processing. if (CWinApp::OnIdle(lCount)) return TRUE; // The base class CWinApp::OnIdle reserves the lCount values 0 // and 1 for the framework's own idle processing. If you wish to // share idle processing time at a peer level with the framework, // then replace the above if-statement with a straight call to // CWinApp::OnIdle; and then add a case statement for lCount value // 0 and/or 1. Study the base class implementation first to // understand how your idle loop tasks will compete with the // framework's idle loop processing. switch (lCount) { case 2: Task1(); return TRUE; // next time give Task2 a chance case 3: Task2(); return TRUE; // next time give Task3 and Task4 a chance case 4: Task3(); Task4(); return FALSE; // cycle through the idle loop tasks again } return TRUE; }
int _tmain(int argc, _TCHAR* argv[]) { srand(time(NULL)); Task1(); //Task2(); Task3(); /*Task4();*/ //Task5(); return 0; }
int main (void) { // initialize the timer and tasks Timer0Setup(); Task1Setup(); // start the action sei(); while (1) { if(trigger >= 1) { Task1(); } trigger = 0; } return 0; }