| InstallerContactSite Map |
Advanced Installer User Guide | |||
How do I interrogate the licensing library to get license information? |
Answer:After you have initialized the licensing library, use the GetPropertyValue licensing library functions. GetPropertyValue FuntionThe GetPropertyValue function gets the value for an licensing property Syntax UINT GetPropertyValue( __in LPCWSTR propertyName, // name of the licensing property to be read __out LPWSTR result, // buffer where the property value will be written __inout DWORD * resultLen // capacity ); Parameters
Return Value
Sample - C++ ...
typedef UINT (__stdcall * GetPropT)(LPCWSTR, LPWSTR, DWORD *);
...
GetPropT getPropFct = reinterpret_cast<GetPropT>(::GetProcAddress(hModule, "GetPropertyValue"));
CStringW licID;
DWORD len = licID.GetAllocLength();
if ( ERROR_MORE_DATA == (getPropFct)(L"TrialName", licID.GetBuffer(), len) )
{
(getPropFct)(L"TrialName", licID.GetBufferSetLength(len), len)
}Sample - C# ...
[DllImport("Trial.dll", EntryPoint = "GetPropertyValue", CharSet = CharSet.Unicode)]
static extern uint GetPropertyValue(String aPropName, StringBuilder aResult, ref UInt32 aResultLen);
...
StringBuilder val = new StringBuilder();
UInt32 len2 = (UInt32) val.Capacity;
if ( GetPropertyValue( "TrialName", val, ref len2) == 234 )
{
val.EnsureCapacity( (Int32) len2 );
GetPropertyValue( "TrialName", val, ref len2);
}Sample - VB ...
<DllImport("Trial.dll", EntryPoint:="GetPropertyValue", CharSet:=CharSet.Unicode)> _
Private Shared Function GetPropertyValue(ByVal aPropName As String, ByVal aResult As StringBuilder, ByRef _
aResultLen As UInt32) As UInteger
End Function
...
Dim val As StringBuilder = New StringBuilder
Dim len As UInt32 = CType(val.Capacity, UInt32)
If GetPropertyValue("TrialName", val, len) = 234 Then
val = New StringBuilder(CType(len, Int32))
GetPropertyValue("TrialName", val, len)
End IfSample - Java public class MyMainClass {
public native static String GetPropertyValue(String aName) throws Exception;
...
try {
String value = GetPropertyValue("TrialName");
...
} catch (Exception e) {
e.printStackTrace();
}
...
} |
