Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

source code to implement limited time feature on a software

Posted on 1998-11-19
2
Medium Priority
?
188 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 100 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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

610 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