Jaradat
Posts: 29
Joined: Sun Feb 23, 2014 1:25 pm

Trail Setup

Dear AdvancedInstaller team

I want to know if i understand well about Trail setup or there is something missing or unclear to me.
-We have C# application
- From page Trail & Registration -> New Trail -> define a new Trail -> complete the forms
- A new DLL (Trialware.dll) created
- Add this DLL to my project
- Add this code in load phase :
// This function does all the work
[DllImport("Trial.dll", EntryPoint = "ReadSettingsStr", CharSet = CharSet.Ansi)]
static extern uint InitTrial(String aKeyCode, IntPtr aHWnd);

// Use this function to register the application when the application is running
[DllImport("Trial.dll", EntryPoint = "DisplayRegistrationStr", CharSet = CharSet.Ansi)]
static extern uint DisplayRegistration(String aKeyCode, IntPtr aHWnd);

-But when we ready to include the (Trailware.dll) to our project , it gives assemply error

-Also this code, where we shall add?
// The kLibraryKey is meant to prevent unauthorized use of the library.
// Do not share this key. Replace this key with your own from Advanced Installer
// project > Licensing > Registration > Library Key
private const string kLibraryKey = "177291AA00FE97A4A15EDE12F5FEEE6AEF848E711477E84BA999DEAD60CADA84313821C09E4C";

private static void OnInit()
{
try
{
Process process = Process.GetCurrentProcess();
InitTrial(kLibraryKey, process.MainWindowHandle);
}
catch (DllNotFoundException ex)
{
// Trial dll is missing close the application immediately.
MessageBox.Show(ex.ToString());
Process.GetCurrentProcess().Kill();
}
catch(Exception ex1)
{
MessageBox.Show(ex1.ToString());
}
}

I did all above, but it doesn't work



Regards
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Trail Setup

Hello,

For a detailed example please download our C# sample from the end of the article you mentioned. Here is a a direct download link:
http://www.advancedinstaller.com/exampl ... xample.zip

The sample shows where to place the code.

Let us know if you still encounter problems.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”