Solved

Two settimers at the same time

Posted on 2000-04-09
5
165 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
Expand data scrubbing tool 13 32
method notes when mouse over in eclipse 5 86
zeroMAx challenge 20 99
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

816 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

11 Experts available now in Live!

Get 1:1 Help Now