PP_TCODE()

Decodes which Trigger Code number was entered

Applies to:

Win32, Win64

Syntax-VB:

Declare Function pp_tcode(ByVal number As Long, ByVal cenum As Long, ByVal computer As Long, ByVal seed As Long) As Long

Syntax-C:

LONG pp_tcode(LONG number, LONG cenum, LONG computer, LONG seed)

Arguments:

<number> is the number input from the user

<cenum> is the code entry number given by pp_cenum()

<computer> is the computer ID number given by pp_compno()

<seed> is a number used to randomize the algorithm

Returns:

1 through 50 - (representing sequence number for Trigger Codes ), 0 - Invalid code entered

Description:

Compares the <number> entered by the user to the other three parameters to see if there is a match to one of the current Trigger Codes. If the value is correct, it returns a number from 1 to 50 to represent the function to be executed. Otherwise, a zero is returned indicating an invalid code was entered by the user.

Example:

' See if a valid trigger code was entered

 

' The client was just given a trigger code. We will grab

' this trigger code from the form into the pp_tcode()

' function to determine which trigger code it was. It is

' important that the same values used for cenum, compno

' and seed are the same values that were used to generate

' the trigger code. We have arbitrarily defined code 1 to

' trigger a demo extension and code 2 to give the user

' full functionality. Since we are not using any of the

' other codes any else will be considered an error.

Dim result As Long

result = pp_tcode(Val(txtCodeEntered.Text), cenum, compno, 400)

Select Case result

 Case 1

 ' Extend demo 30 days 

Case 2 

' Allow full functionality 

Case Else 

MsgBox "Invalid Code entered!" 

End Select

See Also:

PP_CENUM(), PP_COMPNO()

Concept Link IconRelated Topics