Solved

Two settimers at the same time

Posted on 2000-04-09
5
163 Views
Last Modified: 2013-11-20
Dear experts,

I need to have two timers which time two different actions in my app.
Is it possible to have two timers at one time? If yes, how can I achieve this?

0
Comment
Question by:Aphroditus
5 Comments
 

Expert Comment

by:bertp
ID: 2698179
yes, just use different IDs when setting up the timers.   parameters sent with the WM_TIMER message will tell you which timer the message is servicing
0
 
LVL 23

Expert Comment

by:chensu
ID: 2698374
Yes, just use different timer IDs as bertp already said. See

http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/psdk/winui/timers_1voy.htm
0
 
LVL 1

Accepted Solution

by:
elston_sa earned 50 total points
ID: 2699115
#define TIMER1 1
#define TIMER1 2

//SetTImer 1
SetTimer(
MainframeHandle, // handle to window
TIMER1,// timer identifier
100, // time-out value
NULL // timer procedure
);

//SetTImer 2
SetTimer(
MainframeHandle, // handle to window
TIMER2,// timer identifier
100, // time-out value
NULL // timer procedure
);

......Now overide the,

OnTimer( UINT nIDEvent );

function of Mainframe Class and put the following code

switch (nIDEvent)
{
  case TIMER1:
   //Action  One
 
  case TIMER2:
  //Action two
};
0
 
LVL 23

Expert Comment

by:chensu
ID: 2699178
elston_sa's code is almost the same as the code shown on the page I provided.
0
 

Author Comment

by:Aphroditus
ID: 2706676
Thanks! It works well...
Thanks to you too chensu. :)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 102
iSeries FTP Exit Program 8 114
format the code in java 6 72
unix example issues 18 47
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now