Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternative to System Date

Status
Not open for further replies.

aac11

Programmer
Mar 6, 2002
3
US
I am developing a VB program and I wanted to control execution of the program using a datescope or up-to-a-certain-date provision. Eg. Oct 1 to Oct 30, or up to Oct 30). We know that it is easy to workaround this by just changing the date before runnnig the program. Is there any way for VB to get the actual date other than the system date? If none, how can I address this problem? Thanks in advance.
 
one workaround would be to get the timestamp from a server off the internet.
an even easier way would be to set up a special webpage, which would only have the current time as text. then you could extract it from there.
alternatively you could set up a PERL CGI script that will return the current timestamp. it is possible to access cgi scripts using inet control (i think its that one).

if you don't have access to the internet, but are connected to a lan, you could get the timestamp from other machines on the network using various api calls.

another method would be to save the install-date to a resource file (i haven't tried saving things to a .res file at runtime yet, but i would think that it should work). then compare the saved timestamp with the system clock each time the program is started. if the system time is greater than the saved timestamp, save this time as well (keep the original install-timestamp, though).
if the system date is smaller than the install-date, then you will know that the system date has been tampered with and you can disable the app.
if the date checks out the first time, compare the newly saved timestamp (not the install-date timestamp) with the system time. again make sure that the system time is greater then the saved date. if so, save this date (overwrite the second date, not the install-date); if not, you can disable the app.
as a second criteria (other than the system date being greater than saved date) you can check to see if the system date is 180 days from install date, or check for a specific date, e.g. october 30, and then disable the app.

hope that helps. i know this sounds all very convoluded, but if you have any questions, please post them, and i'll be happy to go into more detail.

good luck!
Take Care,
Mike
 
You could grab the datelastmodified from a file like user.fat which is write every boot and compare with whatever you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top