Solved

MFC - Timers for days and months ?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

12 Experts available now in Live!

Get 1:1 Help Now