pp_eztrial1()
Runs the EZ Trial™ algorithm
Applies to:
Win32, Win64
Syntax-VB:
Declare Function pp_eztrial1(ByVal file As String, ByVal password As String, ByRef errorcode As Long, ByRef lfhandle As Long) As Long
Syntax-C:
LONG pp_eztrial1(LPSTR file, LPSTR password, LPLONG errorcode, LPLONG lfhandle)
Arguments:
<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.
Returns:
A status flag indicating the mode of the application. If PP_FAILURE [0] 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
Description:
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 using EZTrial with Software Binding disabled the EZTrial function will still create and check for aliases while in demo mode.
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().
CAUTION
Any Long Integer buffer value passed by reference in <lfhandle> parameter
must be initialized to 0 the FIRST time this function is called. Otherwise,
this function assumes a valid pointer to a License File handle and may
cause an application violation error.
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
Example:
Dim errorcode as Long, result As Long
result=pp_eztrial1(App.Path & "\license.ini", "password", errorcode, 0)
Select Case result
Case 0:
' error opening file
MsgBox "File Error #" & errorcode
Case 1:
Case 6:
' do nothing, this is a retail product
' (even if it is in Periodic expiration mode)
Case 2:
' 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
Case 3:
' retail application failed software binding
MsgBox "Error 3 - Security violation"
End
Case 4:
' demo that has expired
MsgBox "This product has expired"
End
Case 5:
' clock has been turned back on demo
MsgBox "Clock has been turned back. Please fix."
End
End Select
See Also: