Click here to Skip to main content
15,906,569 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made an application with c# and need to apply trail on user machine only for 30days how can i check it??
Posted
Comments
bbirajdar 19-Feb-13 0:00am    
what is trail? If you are speaking of this http://www.google.co.in/search?q=define%3A+trail&oq=define%3A+trail&sourceid=chrome&ie=UTF-8 then create temporary text files
Hetal Jariwala 19-Feb-13 0:02am    
and how can i check if 30 days has done or not??

Hi,

i suggest the below steps.

-> create two variables in registry - Installed Date, Last opened date with different keys.
-> In main function,
* if the installed date is empty or null, write the cuurent date
* also write the last opened date to current date.
* If installed is not null or empty, check for 30 days with current date. if it less than 30 (user may change system date), then check with last opened date.
* if you found, the date cross 30 days, stop all functionality of the application and show the message to user.

you can refer Read, write and delete from registry with C#[^] for more information.

you can also refer Make Your Application with Trial Version[^]

hope it helps.
 
Share this answer
 
Comments
Hetal Jariwala 19-Feb-13 0:16am    
And what if user change system date???
Karthik Harve 19-Feb-13 0:24am    
That is why, you will have last accessed date. you can check that date with installed date.
Hetal Jariwala 19-Feb-13 0:29am    
ok thnx
Karthik Harve 19-Feb-13 0:30am    
welcome.!
bbirajdar 19-Feb-13 4:56am    
Good one.. +5
If your going with the file based solution suggested by aspnet_regiis then here is below. I typed it into notepad so you might have to tweak it but it should work out.

C#
using System.IO;

DateTime fileDateCreated = File.GetCreationTime(@"C:\temp\your_trail_file.txt");
DateTime now = DateTime.Now;
TimeSpan span = now - fileDateCreated;
int totalDays = span.TotalDays;

if(totalDays > 30)
{
	//Delete Trail File or whatever logic you wish to perform
}
 
Share this answer
 
Comments
Shambhoo kumar 19-Feb-13 0:41am    
nice work.
bbirajdar 19-Feb-13 4:59am    
Yup.. I agree.. In fact my suggestion was very general in nature since the question was vague and incomplete.. What the question reflected was that some school student trying to write a program and too lazy with the keyboard to write a detailed description of the problem.. BTW +5
David_Wimbley 19-Feb-13 11:39am    
Thank you much!

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