We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jmdapozzo
Posts: 1
Joined: Fri Feb 05, 2016 10:32 pm

Licensing a service

Hi,

My application consist of a Windows Service and a Client using WCF on the same machine.
I would like to use the Licensing installation option for this project.

In your C# example you have the following initialization code:
InitTrial(kLibraryKey, process.MainWindowHandle);
However, a Windows Service does not have a MainWindowHandle.
As you may know, a Windows Service does have a ServiceHandle which is an IntPtr.
Question 1: Can I use InitTrial with a ServiceHandle?

Another problem is that the InitTrial will display a dialog and also kill the application at the end of the trial period.
It seems that I can use the InitTrialReturn function (see below) as this function will not kill my service.
However, it is unclear if this function will or not, display a dialog.
Question 2: Will this function display a dialog or requires any "desktop" resource?

Finally, if I am able to use the AI Licensing scheme on my Windows Service, will I be able to use the DisplayRegistration function in the client and the result be available to the service?
Question 3: Is the registration global to the machine?

Thanks,
Jean-Marc Da Pozzo
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Licensing a service

Hello Jean-Marc and welcome to our forums,

Q1: No, to use the "InitTrial" method with a service you should call it using "null" as its second parameter, like this:

Code: Select all

InitTrial(kLibraryKey, null);
Q2: The "InitTrial" method doesn't display any dialog if you set the trial display percent to 0; only the "DisplayRegistration" method will do. To integrate our Licensing module in your service application you can try to use a similar approach like it is exposed in our "how to add trial support for an console application" forum thread.

Q3: This can be configured by you in "Licensing page -> Registration tab -> Runtime Key Location" section.

Let us know if this helped.

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

Return to “Common Problems”