Solved

MFC - Timers for days and months ?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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.

762 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