Solved

MFC - Timers for days and months ?

Posted on 2004-04-16
4
241 Views
Last Modified: 2013-11-20
HI All
     I am working on a module  ( using MFC ) in which my application should alert me after some time interval.That time interval might be in minutes , in hours , in days, in months.What I have done for to achieve this, I set the timer of 30 minutes, And after each 30 mintues I am checking remaining time period, If it reached to 0 ( zero) , then I am firing an event to alert user.
        This is fine if the time interval is in minutes or hours and the application is in system tray.But it might happen that time period will be in days and months.In this case, How can I set the timers for such a long period.Is there any timers for days and months which will fire an event after the specified days.I don't want to do this by comparing system date.

0
Comment
Question by:rollocool
[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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:akalmani
ID: 10842794
Registry would be of some help but imagine if the system is shutdown there is no way u can keep the timers running..
0
 
LVL 3

Accepted Solution

by:
akalmani earned 30 total points
ID: 10842903
Take a look at this, your question is similar to this. A number of solutions are posted.

http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_20899766.html
0
 
LVL 4

Expert Comment

by:caner_elci
ID: 10843231
I coded some application that does the same thing as an alerter... There, I did this:

When I need to schedule a timer, I calculated the exact alarm time as a CDateTime variable, or in my example an array of variables.. Then I set a timer set to 30 secs.. that will generate one WM_TIMER in every minute.. Then, when WM_TIMER is fired, I walked through my array and checked if any of them is ready to alert..

This solution may help you..

Caner ELCI
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10844415
I think you will have to resort to checking the system date at some point.  Maybe you should write the target date/time to the registry (to cope with your app being halted and restarted).
When your app is running then you will need a timer to regularly check how close you are to your target.
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

630 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