Solved

Two settimers at the same time

Posted on 2000-04-09
5
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 59
Named range not carried over 10 70
ASCII Non-Printable characters/codes and their HTML equivalents 6 158
Detect file exist or not 3 215
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

734 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