I'm having an issue accessing the ComputerID when the license is expired.
I have a custom registration window that I populate to supply the user with software information when asking them to register their license. It works great when the software is within the trial period, but once it exceeds said period my call to the ComputerID property returns a value of (5 or 13 - cannot recall which).
Is there a different method needed to acquire the ComputerID when the license is not registered? Or is there an additional step if the license registration fails in order to access the ComputerID?
Thanks for the help,
Francis
A previous thread I opened and discussed this issue
Code: Select all
public bool tryGetMachineID(out string machineID)
{
return tryGetProperty(@"CompId", out machineID);
}
private bool tryGetProperty(string propertyId, out string property)
{
var val = new StringBuilder();
var len = (uint) val.Capacity;
try
{
int result = (int) getProperty(propertyId, val, ref len);
if (result != 0)
{
if (result == 234)
{
val.EnsureCapacity((int) len);
getProperty(propertyId, val, ref len);
}
else
{
property = string.Empty;
return false;
}
}
property = val.ToString().Trim();
return true;
}
catch (Exception)
{
property = string.Empty;
return false;
}
}
private static uint getProperty(string propertyName, StringBuilder val, ref uint len)
{
return GetPropertyValue(propertyName, val, ref len);
}
[DllImport("Licensing.dll", EntryPoint = "GetPropertyValue", CharSet = CharSet.Unicode)]
private static extern uint GetPropertyValue(string aPropName, StringBuilder aResult, ref uint aResultLen);
//Initialize the registration - if no registration but trial is valid, place in trial mode
[DllImport("Licensing.dll", EntryPoint = "ReadSettingsRetStr", CharSet = CharSet.Ansi)]
private static extern uint InitTrial(string aKeyCode, IntPtr aHWnd);
FOLLOW US
Get the latest news in Application Packaging