The problem is after running the app only once, return code is 5 although its still in trial.
I have followed the code from tutorial example as below
Code: Select all
private const string kLibraryKey = "actualKey";
[DllImport("Trial.dll", EntryPoint = "ReadSettingsRetStr", CharSet = CharSet.Ansi)]
static extern uint InitTrialReturn(String aKeyCode, IntPtr aHWnd);
private static void checkRegistrationStatus()
{
try
{
Process process = Process.GetCurrentProcess();
uint retCode = InitTrialReturn(kLibraryKey, process.MainWindowHandle);
if (retCode >= 4)
{
Process.GetCurrentProcess().Kill();
}
}
catch (DllNotFoundException exTrialDllNotFound)
{
MessageBox.Show(exTrialDllNotFound.ToString());
Process.GetCurrentProcess().Kill();
}
catch (Exception exCheckRegistrationStatus)
{
MessageBox.Show(exCheckRegistrationStatus.ToString());
Process.GetCurrentProcess().Kill();
}
}
Code: Select all
checkRegistrationStatus();
FOLLOW US
Get the latest news in Application Packaging