Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hi,
 
How to SetTimer for a Win32 console application for a period of 3 months.
 
When 3 Months completed it should stop the application to run.
 
We need to remind that its not a continuos running application.
 
Can anyone help regarding this issue.
 
Thanks in Advance.
Posted 2-Sep-12 17:39pm
Kumar 091.2K
Comments
Wes Aday at 2-Sep-12 22:43pm
   
A timer is set in milliseconds so just do the math. And a timer for a interval of 3 months screams bad design. Why don't you just check to see if the date is 3 months from when you started your app?
Member 9197184 at 2-Sep-12 22:53pm
   
i am new to timers can u give me a sample code. i had been trying hard for this but i couldn't get it. any sample code.
Wes Aday at 4-Sep-12 22:47pm
   
Reading the documentation is a real good place to start, http://msdn.microsoft.com/en-us/library/49313fdf%28v=vs.71%29.aspx
pasztorpisti at 3-Sep-12 3:29am
   
When the user starts your program you have to save the time of the first start to some evil hard to find place (registry). Consequent successful program starts should always check if the 3 month period has passed and the first time you detect this you should save a flag indicating the end of the period to your evil hidden place to prevent the users from using your program by setting the clock back a few weeks. The functions you should use are already mentioned below in the answer list.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

How about something like this:
http://support.microsoft.com/kb/308569[^]
 
And in your program use this:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^]
 
and call datetime.now to see the current date. You could store the last date in a txt file:
http://msdn.microsoft.com/en-us/library/92e05ft3.aspx[^]
http://msdn.microsoft.com/en-us/library/s2tte0y1.aspx[^]
 
anything else? Wink | ;)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 2 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100