LicenceNotFoundHandlerProc

The LicenceNotFoundHandlerProc function is an application-defined callback function that can be called if the program licence cannot be found. This callback function is specified by calling C_RegisterLicenceNotFoundHandler.

void __stdcall LicenceNotFoundHandlerProc(

int Action,

BOOL *lpAttemptReconnection,

INT_PTR *lpData

);

Parameters

Action (IN)

An integer value that identifies the current stage of the licence reconnection. Can be one of the following values: lrBegin, lrContinue or lrEnd.

lpAttemptReconnection (IN/OUT)

Points to a BOOL variable which determines whether reconnection should be attempted – set this BOOL variable non-zero to attempt reconnection.

lpData (IN/OUT)

Points to an application defined value that can be used to maintain state between successive invocations of the callback function. Typically the callback function would assign a value to *lpData when handling the lrBegin action. This value could then be used in subsequent lrContinue actions. If any tidy up is needed that would be performed when handling lrEnd.

Remarks

If a callback function is registered, and the licence cannot be found, then the callback function is called in the following sequence:

As an example of how this callback might be implemented, this function attempts to reconnect every minute and gives up after 10 attempts.

void __stdcall LicenceNotFoundHandlerProc(int Action, BOOL *lpAttemptReconnection, INT_PTR *lpData)

{

switch (Action)

{

case lrBegin:

Sleep(60*1000); // wait for a minute

*lpAttemptReconnection = TRUE;

*lpData = 1; // initialise reconnection attempt count

return;

case lrContinue:

*lpAttemptReconnection = *lpData < 10; // stop after 10 failures

*lpData++; // increment reconnection count

if (*lpAttemptReconnection)

Sleep(60*1000); // wait for a minute

return;

case lrEnd:

; // nothing to do, test *lpAttemptReconnection to determine whether connection succeeded

}

}

See also

C_RegisterLicenceNotFoundHandler.