Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use two setTIMER:


SetTimer(3402,1000,NULL);


SetTimer(3401, 1200, NULL);




if (nIDEvent == 3401)

       {
           KillTimer(3402);

           KillTimer(3401);



but if the time of 3401 is bigger than the time of 3402 it doesn't work..why?

What I have tried:

I tried to put time of 3401 the same of time of 3402 and it works, but time of 3401 must be bigger for my program...thanks
Posted
Updated 6-Feb-20 0:13am
Comments
Richard MacCutchan 6-Feb-20 4:20am    
"it doesn't work"
What exactly does that mean?
Richard MacCutchan 6-Feb-20 4:35am    
I just tried that and it works fine.
Member 14594285 6-Feb-20 4:57am    
mmm...it's strange because if I use a time of 3401 bigger then time of 3402 program dooesn't work
Member 14594285 6-Feb-20 4:57am    
it doesn't work..timer for 3402 doesn't start
Member 14594285 6-Feb-20 4:58am    
I didn't say that setTimer(3401) is inside function of setTimer(3402);

1 solution

Timer 3402 did start but you did not check for it in your if condition. Try the if condition below.

C++
if (nIDEvent == 3401 || nIDEvent == 3402)
{
   KillTimer(3402);

   KillTimer(3401);
 
Share this answer
 
Comments
Member 14594285 6-Feb-20 6:13am    
I solved, thanks
Richard MacCutchan 6-Feb-20 6:20am    
It is not necessary to test for both. I ran the code with only the test for 3401 and it successfully killed both timers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900