Solved

MFC - Timers for days and months ?

Posted on 2004-04-16
4
230 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

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…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

9 Experts available now in Live!

Get 1:1 Help Now