Click here to Skip to main content
13,294,516 members (56,357 online)
Rate this:
Please Sign up or sign in to vote.
How can i disable the .exe file i have made after certain days like 30 days.
It's not about running trial on pc for 30days but simply disable exe after 30days of build
Posted 17-Feb-13 23:22pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can run a background thread to compare current date with the build date after every 12/24 hours interval.
Hetal Jariwala 18-Feb-13 4:41am
but it's gng to run on diffrent pcs
Hetal Jariwala 18-Feb-13 4:41am
and diffrent clients will access them on diffrent tym
Rumnha 18-Feb-13 4:45am
You have one .exe per pc running on different pcs. And .exe has the code to compare dates. Why do you think this will not work?
H.Brydon 18-Feb-13 15:27pm
Creating a background thread for this isn't a great way to do it. Simply add a small API that you check every now and then whenever you do something 'important' that compares the current date with build date. This API could be probably 10 lines of code. You don't need a separate thread for that.
Rumnha 18-Feb-13 21:57pm
Thanks Brydon for looking into this and I would like to learn from you why it isn't a great way to have background thread which check build date after a configurable interval.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

using below method and validate to server also
How to make trail of Software using c#[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

if you think internet connection is available where your .exe is going to be run.
then you can make a web request "" it will return you current date and time. then you can compare this date with your build date and disable your .exe.
the advantage of this is
1 : it will insure that your .exe file will not work after 30 days. even user has refreshed windows cause it is PC independent.
2 : the above solution fails if user change the date time or set to early days just exception
cause your current date time is the local date time of the PC
how to make a web request in c# ?

var http = (HttpWebRequest)WebRequest.Create("");
var response = http.GetResponse();
var stream = response.GetResponseStream();
var sr = new StreamReader(stream);
var jsonCurrentDate= sr.ReadToEnd();
//jsonCurrentDate fetch date and time from this.
// and code accordingly
Hetal Jariwala 27-Feb-13 0:11am
but internet connection may or may not be available and if it's not available then also .exe should run
Sm.Abdullah 27-Feb-13 0:37am
simple .. if connection not available after checking internet connection then depend on user Local time.logic remain the same... once you find your application time expired then set a bool expired. next check that bool first then local time.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
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