How to get the number of allowed activations of a license
private int GetNumLicensesInKey ()
{
int numLicenses = -1;
string ak = string.Empty;
string ck = string.Empty;
string computerID = Environment.MachineName;
bool needsActivation = false;
string returnMessage = string.Empty;
lv.QlmLicenseObject.ReadKeys(ref ak, ref ck);
if (!String.IsNullOrEmpty (ak))
{
// Make sure you use the activation key and not the computerKey to check the number of activations embedded in the key
// The computerKey will always have a single license embedded in the key, except for floating licenses.
if (lv.ValidateLicense (ak, string.Empty, computerID, ref needsActivation, ref returnMessage))
{
numLicenses = lv.QlmLicenseObject.NumberOfLicenses;
}
else if (needsActivation)
{
numLicenses = lv.QlmLicenseObject.NumberOfLicenses;
}
else
{
// the license is not valid
}
}
return numLicenses;
}PreviousHow to add the QLM .NET Controls to the Visual Studio ToolboxNextHow to configure the maintenance plan to start upon activation
Last updated