Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
[no name] 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?
Kumar 09 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.
[no name] 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 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

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? ;)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900