i can't use the licensing support in c#! i make a test app and have a errormessage on start! System.AccessViolationException
here is the test app (kLibraryKey is not real
using .NET 2.0
Code: Select all
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ACTestApp
{
class Program
{
[DllImport("Trial.dll", EntryPoint = "ReadSettingsStr", CharSet = CharSet.Ansi)]
static extern uint InitTrial(String aKeyCode, IntPtr aHWnd);
[DllImport("Trial.dll", EntryPoint = "DisplayRegistrationStr", CharSet = CharSet.Ansi)]
static extern uint DisplayRegistration(String aKeyCode, IntPtr aHWnd);
public static void Main()
{
OnInit();
Console.WriteLine("Welcome to ACTestApp!");
Console.ReadKey();
}
private const string kLibraryKey = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static void OnInit()
{
try
{
Process process = Process.GetCurrentProcess();
InitTrial(kLibraryKey, process.MainWindowHandle);
}
catch (DllNotFoundException ex)
{
Console.WriteLine(ex.ToString());
Process.GetCurrentProcess().Kill();
}
catch(Exception ex1)
{
Console.WriteLine(ex1.ToString());
}
}
}
}
FOLLOW US
Get the latest news in Application Packaging