Solved

source code to implement limited time feature on a software

Posted on 1998-11-19
2
185 Views
Last Modified: 2010-04-15
Can anybody tell me the source code to add the limited time
feature to a software?
0
Comment
Question by:SHAHZAD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:emmons
ID: 1254478
There are lots of ways to do it.
If you are in Windows, you could add a date to the registry or config file, and compare against that (more robustly, you could encrypt the date before saving it)
You could create a data file for your program on install (or on first run) and then compare against that date. This is a little more portable, but it involves asking the OS for the date stamp on a file and comparing it against the current date. Or put the date in the file.
0
 

Accepted Solution

by:
masche earned 50 total points
ID: 1254479
here is a simple solution of mine:

{
        struct tm *newtime;
        time_t long_time;

        time( &long_time );                /* Get time as long integer. */
        newtime = localtime( &long_time ); /* Convert to local time. */

        if( newtime->tm_year >= 98 )       {
      if( newtime->tm_mon >= 12  )   {
             AfxMessageBox ( "Program has timed out !!!") ;
            timedOut= 1 ;
      }
        }
        if ( !timedOut)       {              // let's check the file PAGEFILE.SYS
                                                          // for those who changed their clock...
      char *FileName = "C:\\PAGEFILE.SYS" ;
       time_t now= time(NULL) ;

      for ( int i=0 ; i<10 ; ++i )     {
           int result;
           struct _stat buf;
           result = _stat( FileName, &buf );
        /* Check if statistics are valid: */
           if( result == 0 )      {
            if ( (now< buf.st_ctime )  )   {
            AfxMessageBox ("You changed your clock! Program ist timed out!!!") ;
            timedOut;
            break ;
               }
      }
      ++FileName[0] ;              // c: / d: / e:...
      }
      }
}

I hope this helped!

Harald
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question