Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 14 Other Features

14.9 Document Licensing

Scroll Prev Top Next More

To protect a document you have created from being edited, you can use the document editing password described in 3.8 Document Settings.  However, this does not prevent someone from purchasing a Runtime licence of DAQFactory (or using the embedded license from your Developer created document) and running your application on multiple computers.  There are also occasions where you are providing a complete system with hardware and software and you want to make sure that you get paid.  For both these cases, and probably others, DAQFactory supports a document licensing feature.  Once enabled, whenever your document is opened on a new computer, it will not function until a key is provided to either make your document fully functioning forever, or to have it expire after a preset amount of time.  This mechanism is document specific and completely separate from the licensing mechanism used by DAQFactory itself.

Note: we strongly recommend creating a very simple document first and playing with this feature with that document instead of your complete, complex application so that you fully understand how this system works.  Once you are comfortable with it you can set it up on your main document using a different license file.

To use this feature, select File - Document Licensing... from the main menu.  A popup will appear with the licensing administration options:

 

userAppLicensingSetup

 

First you will need to Enable the feature, but in addition to selected Enabled, you will need to provide a full path and file name for the license file.  This file is where licensing information is stored.  It will need to be located in a location where DAQFactory can write to it, but otherwise can be any file name.  We recommend using something that isn't obvious, for example, a random name with a .dll extension.  It is up to you, but do not create a file in the DAQFactory folder with .dds or .ddp as all of these are loaded by DAQFactory on startup.  The folder MUST exist where the file is to be created.  DAQFactory will not create the folder for you and the licensing won't stick if the folder does not exist.

Finally you must provide a password of at least 4 characters.  This password is separate from any document editing password you may have implemented.  That way, you can provide the document editing password to your employees to allow them to enhance the document, but without enabling them to license your customers.  Once you specify a password, you can only get to the setup popup by entering the password.  For extra security, if an incorrect password is entered trying to get to the setup popup, DAQFactory will assume someone is trying to break your lock and will quit.  This makes it much harder for someone to try a bunch of passwords in hopes of figuring it out.

Do not lose your password!  We cannot recover it for you!

If you lose the password you will not be able to use your application on systems that aren't otherwise licensed and you won't be able to install your application on any new computers.  Once again, while we can recover document editing passwords for a fee and subject to proof that you created the document, we CANNOT recover the licensing password for you as there is no way for you to prove to us that you are the owner of the document other than knowing this password.  That all said, we do offer a document registration service.  You provide us with your document before you enable the license feature, or at least before you have forgotten the licensing password, along with the emails of people authorized to retrieve the password, and in the case of a lost password, we can retrieve it for these individuals or the president / owner of the company it is registered to.  There is a fee for this service and for any password recovery.  We have to have your document ahead of time to retrieve an internal unique identifier.  This identifier stays with your document even after you edit it and is what gets registered with the recovery email addresses.  Please contact us to set this up.

You will likely also want to provide an Expired Message.  When your application is expired, a popup will appear with a key, and requesting a code.  It will also display any message you provide.  This message should in general explain what happened and provide contact information so your customer can get a code.  Please note that this application licensing feature does not support unattended licensing the way DAQFactory is licensed.  Your customer must contact you with a key, and then you have to generate a code from that key and give it them.  The key changes every time the popup appears, so make sure you customer knows not to close the popup before contacting you.

Please be sure to include in the message that your customers should NOT contact AzeoTech for unlock codes!  We cannot generate them even if we wanted to as we do not know your password.  If we get a lot of support calls from our customer's customers asking for unlock codes we will be forced to add a message not to contact us, and would rather let our customer determine what the message should say.

Once enabled, whenever the document is loaded it will look for the license file you specified.  If it does not exist, which would happen on a new install, DAQFactory will create it, marking the application as expired.  The application will not run, and the customer will be prompted with your message and a key and asked for a code.  If the file does exist, DAQFactory will check several things to make sure it is valid.  First it will check that the file was created for this computer.  If not, it will mark it as expired.  This is to prevent someone who discovers which file you are using for licensing from taking a licensed file and copying it to another computer.  Next, DAQFactory will check the times in the license file.  It will first check to make sure that the customer didn't turn back their clock (other than DST), and then it will see if the expiration date has past.  Any of these events will cause the expired popup to appear requesting a code.

Of course when you first enable the document licensing feature, the development computer you are using won't be licensed.  To avoid problems, there are three things to help you:

1) once you go into the license setup popup, all license checking for the machine you are on is disabled until DAQFactory restarts or the application is reloaded.

2) in the license setup popup there are 4 buttons along the bottom that allow you to license the computer you are using without using the key/code mechanism.  So once you enable it on your development machine, you can simply click the Unlock button under License this Computer so that your development computer doesn't prompt you for a code.  These buttons are also useful if you are shipping a PC complete with DAQFactory to your customer.  You can thus install your application and go to the license setup popup and select one of the 3 expiration times and the application will run until the specified number of days has occurred.

3) if you are presented with the expired popup requesting a code, you can type in "admin" without the quotes and get to the license setup popup.  You will, of course, be prompted for your password first, and if you enter the wrong one, like before the application will quit.  This works even on runtime installations, though it is important to note that on Runtime installations, any changes to the license settings won't be saved unless you provided a button to save your document.  In general, if accessing from a runtime license, you will only want to use the License this Computer or Generate Keys buttons.

Unlocking a customer computer:

When your application expires on your customer's computer, the unlock dialog will appear with your message and a key.  The customer will be prompted for a code.  They will need to contact you to get this code.  Again, make sure your customer understands they cannot contact AzeoTech for unlock codes for your application.  Since your password is used in generating the codes, and we don't know your password, we cannot generate the codes.  When they contact you, they will provide you with the key displayed.  This key changes every time the popup appears, so make sure your customer doesn't close the popup before the process is complete.  You will then open your application (in Safe mode if you want) on your computer and go to the licensing setup popup (File - Document Licensing...) and select one of the four buttons under Generate Keys depending on what you want to have happen on the customer computer.  You will be prompted for their key, and then a code will be provided which you will give to your customer who will enter it in their popup.  The three options for keys with days are based on the current time on the customer computer, so 15 days will cause the customer application to expire 15 days from now.  It does not extend whatever time they might have already had left.

Script access:

The expired popup will appear pretty much immediately once the expiration time has past.  Since a process may be running, there is a system event that is called OnExpiry that is run right before the expiration popup is displayed.  Use this to safely shutdown the system.  Simply create a sequence called OnExpiry and put your desired script in there.  No matter whether the customer enters a valid unlock code or an invalid one, DAQFactory will quit once the popup is closed.  If they entered a valid code, then the license is changed the next time DAQFactory loads the application.

In addition to this event, there are several functions available.  They all start with AppLicense., so for example: AppLicense.GetExpiry()

GetExpiry(): returns the time the document will expire, or 0 if its licensed fully and won't expire.  Use this to display warnings so your customer knows that their application will expire soon.  The value returned is a DAQFactory timestamp, so in seconds since 1970.  You can use the formatDateTime() or other time functions to help display this value.  To calculate time left, subtract SysTime() from this value. So for example, to display the number of hours left you would use this expression:

 

(AppLicense.GetExpiry() - SysTime()) / 3600

SetExpiry(seconds from now): sets the expiry time.  This is calculated by adding the parameter passed to the current time.  So, to set the expiry for 24 hours from now, you would do: AppLicense.SetExpiry(86400).  Note that you cannot set the expiry date past the current expiry date.  You can only make the expiration date sooner.  This is to prevent someone who has the document editing password from continually extending the expiration date.

DisplayUnlockDialog(): displays the unlock popup.  We strongly recommend providing a button to allow access to the unlock dialog before the application expires.  You should make sure your application is in a safe state before allowing this function to be called.

DisplaySetupDialog(): displays the licensing setup popup.  The password of course needs to be entered, and if it is entered incorrectly DAQFactory will quit.  OnExpiry() is not called, so you should make sure your application is in a safe state before allowing this function to be called.