FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

FB II COMPILER

Put an expiration date into a program



You put the expiration date into your program. If the current date is beyond the expiration date, then do whatever you want. The code follows:

'the following code is designed to provide a limit to the time that
'a person can use this software. It works by checking the current
'date and comparing it to an internal date of 06/01/94
'if the current date is over that time period, then notes an error and ends...

a$ = DATE$
year$ = RIGHT$(a$,2)
month$ = LEFT$(a$,2)
year = VAL(year$)
month = VAL(month$)

LONG IF year > 93 AND month > 6
  FN doError (Msg$) 'display error message
  END 'let's not work anymore...
END IF

Tedd


The code has a Y2k problem.
Maybe use _AbbrevDate as described on p86 of the FBII Ref Manual, and get the right 4 digits of the string ie 1998 instead of 98.

Peter


You can get around that simply by changing:

LONG IF year > 93 AND month > 6

to:

LONG IF year <> 93 AND month > 6

The program will work again in 2093 for 6 months, but I don't think you'll have to worry about it by then :)

Al Staffieri Jr.


Set up a global in your program to record the date/time of compile and then add the time out period. This global should be part of your stored preferences.

LONG IF SYSTEM(_aplFlag) = _False
  gTimeOut& = [_time]+30*24*60*60
  REM now + 30 days, 24 hours, 60 min, 60 secs
END IF

(NOTE: If this is a non-timed out version, set the global to zero.)

During your init phase check this global and, if necessary, set your program to close.

LONG IF gTimeOut&
  LONG IF [_time] > gTimeOut&
    gKissOfDeath = _zTrue
  END IF
END IF

STAZ ~)~