The additional information that you need to capture from the User via your own dialog boxes,
will depend on the License type / options and if this is an initial activation or seat activation, or re-activation as follows:
The Email is optional but recommended. A lost password can be resent using the DNA_SendPassword
API call from the application, or from the DNA Control Panel, or from the License Manager Portal.
If your product does not use "User Authentication", then you will need to define (hard-code) a
"global" default password in your application to be used by all Licenses and used in all DNA API calls.
See User Authentication
for information on using or not using
User Authentication.
With the above information, and based on the status of the License Code, you would then issue one of the following:
Query and Activate or Re-Activate the License using CLASSIC Activation
Highlighted lines indicate where additional code is required or needs to be modified.
// Implement the 2-step Activation / Re-activation process
//
// Step 1 : get License code and call DNA_Query() to determine license status
// Step 2 : get additional info and call DNA_Activate or DNA_Reactivate()
// based on status
//
// Step 1
// get an Activation Code from the User via a dialog box
// use DNA_Query() to determine if activate or re-activate
errNo = DNA_Query(DNA_product_key,activation_code);
// DNA_Query returns:
// - ERR_ACTIVATION_EXPECTED(8) = Single-User License with Roll-Over needs to be activated
// for the 1st time
// - ERR_REACTIVATION_EXPECTED(9) = Single-User License with Roll-Over already activated,
// needs to be re-activated
// - ERR_ACTIVATION_EXPECTED_MU(19) = Single-User License without Roll-Over, Multi-User or Floating License needs to
// be activated for the 1st time
// - ERR_REACTIVATION_EXPECTED_MU(20) = Single-User License without Roll-Over, Multi-User or Floating License already activated,
// this is a new seat activation, use DNA_Reactivate()
// if the code does not exist, DNA_Query() will return 8 as though an activation
//
// Step 2 : based on DNA_Query() result, complete the process
//
if ((errNo == ERR_ACTIVATION_EXPECTED) || (errNo == ERR_ACTIVATION_EXPECTED_MU))
{
// this is an activation, get a password and email address
// if your product does not use User Authentication (i.e. a License
// password), then use a hard-coded non-blank string as a "global"
// Password
// get password and email address from User via dialog box
// you may want to validate the inputs, at a minimum:
// - not >blank<
// - password length not > 16 characters, no spaces
// - valid email format
errNo = DNA_Activate(DNA_product_key, activation_code, license_password, license_email);
// check result code
// - errNo > 0 means failure
// - errNo = 0 and errNo < 0 means success
// see Developer Guides for the full list of return codes
// here we have only simple error checking in place
if (errNo <= 0 )
{
// success, run the application
}
else
{
// error occurred, quit the application
// optionally, you can display an error message
// you can use DNA_ERROR() which translate the errNo into a more
// user-friendly description, or use your own descriptions
DNA_Error(errNo,buffer,sizeof(buffer));
// display error explanation
// quit the application
}
}
if (errNo == ERR_REACTIVATION_EXPECTED)
{
// this is a reactivation for Single-User with Roll-Over Re-Activation
// and User Authentication that requires a current password
// and NEW password
// get current and New password from User via dialog box
// you would also want to validate the inputs, at a minimum:
// - not <blank>
// - password length not > 16 characters, no spaces
// issue the DNA_Reactivate API call and report the result
errNo = DNA_Reactivate(DNA_product_key, activation_code ,license_password, license_new_password);
// check result code
// - errNo > 0 means failure
// - errNo = 0 and errNo < 0 means success
// here we have only simple error checking in place
if (errNo <= 0 )
{
// success, run the application
}
else
{
// error occurred, quit the application
// optionally, you can display an error message
// you can use DNA_ERROR() which translate the errNo into a more
// user-friendly description, or use your own descriptions
DNA_Error(errNo,buffer,sizeof(buffer));
// display error explanation
// quit the application
}
}
if (errNo == ERR_REACTIVATION_EXPECTED_MU)
{
// this is a reactivation for the following license types:
// - Multi-User, Floating
// - Single-User without Roll-Over Reactivation
// - Single-User without User Authentication
// if your product does not use User Authentication (i.e. a License
// password), then use a hard-coded non-blank string as a "global"
// Password
// get License password from User via a dialog box
// issue the DNA_Reactivate API call
// use <blank> for new password and report the result
errNo = DNA_Reactivate(DNA_product_key, activation_code, license_password,"");
// check result code
// - errNo > 0 means failure
// - errNo = 0 and errNo < 0 means success
// here we have only simple error checking in place
if (errNo <= 0 )
{
// success, run the application
}
else
{
// error occurred, quit the application
// optionally, you can display an error message
// you can use DNA_ERROR() which translate the errNo into a more
// user-friendly description, or use your own descriptions
DNA_Error(errNo,buffer,sizeof(buffer));
// display error explanation
// quit the application
}
}