Runs the EZ Trial™ algorithm
Declare Function pp_eztrial1(ByVal file As String, ByVal password As String, ByRef errorcode As Long, ByRef lfhandle As Long) As Long
LONG pp_eztrial1(LPSTR file, LPSTR password, LPLONG errorcode, LPLONG lfhandle)
<file> is the absolute path to the master License File
<password> is the License File password
<errorcode> is a buffer to place an error code. Use NULL pointer to ignore this parameter.
<lfhandle> is a buffer to place the License File handle. Use NULL pointer for this parameter if you choose not to call any of the other PLUS functions requiring the handle. IMPORTANT: Any buffer value passed by reference must be initialized to 0 the first time this function is called.
A status flag indicating the mode of the application. If PP_FAILURE  is returned, a reason code will be returned in <errorcode>. Refer to pp_errorstr() for a table of possible error codes and their meaning. The following is a list of valid status flags that can be returned:
0 - General error occurred, refer to <errorcode>
1 - Retail application; all tests passed
2 - Valid demo that has not expired
3 - Retail application; soft/hardware binding failed
4 - Expired demo
5 - Demo but clock has been turned back
6 - Valid product in Periodic expiration mode
7 - Floating Network License has been exceeded
This function processes the EZ Trial™ algorithm and returns a status flag. A flowchart of the steps taken in this algorithm can be found in the EZ Trial topic under Concepts & Definitions chapter.
When the value of <lfhandle> is 0, the License File is opened and closed by this function. If you pass a Long Integer buffer, this function will leave the License File open and will return a handle to it through the <lfhandle> parameter. You must then close the License file using the function pp_lfclose().
Passing a NULL Pointer in Visual Basic
Visual Basic does not have an easy way to pass a NULL pointer to a function such as this one. It is VERY important to pass a NULL pointer as the last parameter when not using the lfhandle by other library functions. Passing a 0 in VB will not pass a NULL pointer, but rather a pointer to a value of 0, which instructs this function to keep the lfhandle open, thus reserving memory that will never be freed. To pass a null pointer using VB, change the declare statement to the following (change ByRef to ByVal) and pass a 0 for the last two parameters:
Declare Function pp_eztrial1(ByVal hwnd As Long, ByVal filename As String, ByVal password As String, ByVal flags As Long, ByVal errorcode As Long, ByVal lfhandle As Long) As Long
Dim errorcode as Long, result As Long
result=pp_eztrial1(App.Path & "\license.ini", "password", errorcode, 0)
Select Case result
' error opening file
MsgBox "File Error #" & errorcode
' do nothing, this is a retail product
' (even if it is in Periodic expiration mode)
' this is a demo that hasn't expired
' display a nag message and turn off one menu
MsgBox "This is a demo"
Main_Form.mnuOptions.Enabled = False
' retail application failed software binding
MsgBox "Error 3 - Security violation"
' demo that has expired
MsgBox "This product has expired"
' clock has been turned back on demo
MsgBox "Clock has been turned back. Please fix."
PP_EZTRIAL1EX() and PP_LFCLOSE()