USING WHPLUS.DLL TO VALIDATE A HELP FILE
(Updated for WHPLUS.DLL V1.2, dated 5 Dec 1994 01:20am)

The file WHPLUS.DLL can be used to prevent a HLP file
running after its useful life - applicable when the
relevance of the content of the HLP file is subject to
change over time, such as legislation etc.

WHPLUS.DLL is copyright  1994-1995 by John Carroll. However,
the current version V1.2 is made available for the free use
of WinHelp authors. It may not be on-sold or otherwise
distributed for profit without my permission. I would
appreciate feedback and suggestions to enhance it. (It's a
one-trick pony at present!) If you wish to contact me, I can
be reached as follows:

     Internet:      jcarroll@pcug.org.au
     Fidonet        John Carroll   3:/620/243

To use WHPLUS.DLL, put the following in the HPJ file:

HPJ file

[CONFIG]
;allow macros to call message-box
RegisterRoutine("USER.EXE", "MessageBox", "uSSu")
;register date-comparison routine in DLL
RegisterRoutine("WHPLUS.DLL", "FileOld", "i=iiii")
;set flag which won't be cleared unless DLL runs
SaveMark(`NoDLL')
;set flag which must be cleared by DLL to allow HLP to run
SaveMark(`KillFile')

In the source DOC or RTF file, two automatic (footnote)
macros must be entered, normally in the opening topic, as
follows:

DOC file

The HPJ file inserts the marks NoDLL & KillFile. Two macros
are inserted in the Contents topic of the help file, to run
automatically when the file is opened. Each macro tests
first for the existence of KillFile, as none are required if
the focus returns to the Contents topic later in the
session.

Macro1 attempts to call the function FileOld in WHPLUS.DLL,
using the following commands [the numerals passed to FileOld
are in the form (dd,mm,yy,ddd), where the first three are
the start date for the file's life and the fourth is its
life in days]:

(The following macro combination must be all on one line -
it uses the DLL to establish whether (in this example) 180
days have elapsed, starting from 13 June 1994.)

IfThen(IsMark(`KillFile'), `IfThenElse(FileOld(13, 6, 94,
180), `DeleteMark(`NoDLL')', `DeleteMark(`KillFile');
DeleteMark(`NoDLL')')')

Three outcomes are possible.
If successful, the DLL returns the integer value 1 or 0 to
the help file, which interprets it as Boolean TRUE or FALSE.
A1.  If the file is past its use-by date, or the system date
     is obviously incorrect (ie. it predates the help file),
     the DLL returns 1 (TRUE). Macro1 deletes NoDLL and
     leaves KillFile alone.
A2.  If the file is still valid, the DLL returns 0 (FALSE).
     Macro1 deletes the marks NoDLL & KillFile and passes
     control to Macro2.
If the the function FileOld is not found (because the file
is corrupted or is missing from the current directory):
B.   A messagebox warns "Routine not found". When the user
     clicks OK, Macro1 ends without deleting NoDLL or
     KillFile.

Macro2 covers the possibility that the DLL has been deleted
from the current directory. Three outcomes are possible.
C.   Event B occurred and NoDLL still exists. Macro2
     therefore warns the user with a task-modal messagebox,
     waits for acknowledgement, and then shuts down the help
     file.
Alternately, either of events A1 or A2 occurred and NoDLL
was deleted by Macro1.
D1.  The second part of Macro2 finds that KillFile still
     exists, and shuts down the help file.
D2.  The second part of Macro2 finds that KillFile has been
     deleted, so does nothing.

(The following macro combination must be all on one line.)

IfThenElse(IsMark(`NoDLL'), `MessageBox(0, `Cannot find
WHPLUS.DLL - terminating WinHelp.', `File missing!!', 8192);
Exit()', `IfThen(IsMark(`KillFile'),`Exit()')')

NOTE:
1.   The TaskModal code (dec 8192, hex 2000) prevents the
     user focussing the help file until the messagebox is
     cleared.

2.   The DLL pops up a warning messagebox if the remaining
     life of the Help file is 10% or less than allowed. This
     does not interfere with the operation of the Help file.

