Contents - Index


6.9 ActiveX Control

After I make the call to Sherif1.CheckLicence, with the autotrial mode set to false, and the user clicks the "Cancel" button on the authorization screen the program is activated anyway. I notice this is the case on your demo program as well. How do I trap on that condition and not allow the program to become active?
You have to trap events such as OnProductNotLicensed etc. fired up by Sheriff and implement the appropriate "landing" policy. In the case of our demo application, it implements a "soft landing" policy. When the user decides not to give a valid licence key by clicking on the "Cancel" button, the demo lets the user continue to use the application but in a kind of "demo" mode. In other words, the application needs to check if the "cancel" button is pressed and if so to take the desired action.

I am developing a VB application using the Automatic mode ActiveX control - do I have to call RegisterLicence? Where is licence information stored if RegisterLicence is not called?
You don't have to call RegisterLicence. Sheriff by default creates its licence in the location where the Sheriff.dll is installed. However, if you wish to specify your own directory then you will need to call RegisterLicence.

The user requires a licence key in order for the application to work at all. Therefore, do I only need Auto Authorize checked for the Automatic mode to work?
Yes, Auto Authorize will be fine. You might also want to set Auto Renew.

Assuming that I only have Auto Authorize checked, which OnXXXXX events do I need to handle? I think I only need to handle OnError, OnProductNotAuthorized and OnProductNotLicensed. Please confirm.
You have to handle all of the events in order to properly protect your application. Those events are documented in Automatic Mode Event Handlers.

How do I implement unit metering using the ActiveX control?
To implement unit metering in your application with Sheriff ActiveX control you'll have to use it in the Advanced Mode, the Automatic Mode does not support unit metering. There are the following methods involved:

RequestLicenceUnits(UnitsReserved As long, byref UnitsGranted as long,
byref AccessKey as Long) As long

To request a valid licence and reserve a number of units to run the application. AccessKey returns the feature access level defined by the licence.

UpdateLicenceUnits(UnitsReserved As long, UnitsConsumed As long,
byref UnitsGranted As long) As long

To update the licence on heartbeat with the number of units consumed. In addition, to modify the number of units the application wants to reserve.

ReleaseLicenceUnits(UnitsConsumed As long) As long
To release licence when the number units has been consumed in the session.

If there is no units left, the error code "SLS_E_LICENCE_EXHAUSTED" will be returned by RequestLicenceUnits.