[Trial&Registration DLL]Use the trial DLL in a service - Advanced Installer Community
jeremy.vignelles
Posts: 9
Joined: Fri Nov 14, 2014 11:03 am

[Trial&Registration DLL]Use the trial DLL in a service

Hi,
I'm trying to integrate the Trial&Registration DLL to a windows service .NET application, but I'm facing a problem.

I made a test console application in order to illustrate what I'm saying.

Code: Select all

using System;
using System.Runtime.InteropServices;

namespace TestLicensing {
    class Program {
        private const string kLibraryKey = "F1059AF815057E72D12FF5B0B852E699695505F98FE0199C769C6941B963A74AC97904AEC102";

        [DllImport("Trial.dll", EntryPoint = "ReadSettingsRetStr", CharSet = CharSet.Ansi)]
        static extern uint InitTrial(String aKeyCode, IntPtr aHWnd);

        static void Main(string[] args) {
            var result = InitTrial(kLibraryKey, IntPtr.Zero);
            Console.WriteLine(result);
            Console.ReadKey();
        }
    }
}
See the attached file for the error message.

I suspect the IntPtr.Zero to be the cause of the problem. Is there a way to call the method without having a window in my program?

Regards
Attachments
Console application screenshot
Console application screenshot
Capture.PNG (21.02 KiB) Viewed 3829 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: [Trial&Registration DLL]Use the trial DLL in a service

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

To hide our trial dialog you can set the "Display Frequency percent" field, from "Licensing page -> Display tab" of your added trial, to 0 (zero). Also, please take a look on our "Advanced Installer using my custom form for trial.dll" thread which should be useful for your.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jeremy.vignelles
Posts: 9
Joined: Fri Nov 14, 2014 11:03 am

Re: [Trial&Registration DLL]Use the trial DLL in a service

Hi,
I tried again today and it now seems to work...
Maybe I did not compile again the project.

Thanks for your answer :)
Regards
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: [Trial&Registration DLL]Use the trial DLL in a service

You're welcome. I'm glad you got this working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”