jm2008
Posts: 62
Joined: Tue Jul 08, 2008 10:24 am

New License Feature

Hi,

The new license feature is more than great, BUT...How can I use it?? I made the installer with it, but it had no effect!!!

Do I have to do anything except setting the license section???

Am I missing something...

Thanks,
dms
Posts: 164
Joined: Tue Aug 28, 2007 7:11 am
Location: UK

Re: New License Feature

If you are using this feature in a visual studio project then there are a couple of things that you need to do from within your project to make it work. I've cut and pasted below something I was working on in relation to the AI licencing feature. Please Note that this is for a VB.net project, adjust accordingly for C# or C++.


In your project itself; in the main form add the following two imports statements

Imports System
Imports System.Runtime.InteropServices

Then add the following two statements at the top of the class module for the main form.
<DllImport("AI Licensing.dll", EntryPoint:="ReadSettingsStr", CharSet:=CharSet.Ansi)> _
Private Shared Function InitTrial(ByVal aKeyCode As String, ByVal aHWnd As IntPtr) As UInteger
End Function

<DllImport("AI Licensing.dll", EntryPoint:="DisplayRegistrationStr", CharSet:=CharSet.Ansi)> _
Private Shared Function ShowReg(ByVal aKeyCode As String, ByVal aHWnd As IntPtr) As UInteger
End Function

NB "AI Licencensing.dll" should be replaced by the name of the dll that is created for your licensing feature.

The first of these statements is the absolute minimum that you need enter, the second will allow you to called the registration screen from a menu button if you so wish. NOTE that we are refering to the dll that Advanced Installer has added to the files and folders page and which will eventually end up in our appliction directory.
Now in the main form load event add the following line.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'this will call up the trial dialog
InitTrial("C44114CC3B0B846A6DA5F20D11677327E97B7F3AEEC8B64B0DCD13DF77C89A696DE19B7AE53C", 0)

End Sub
The first parameter is the library key from the first tab in the licensing section from your Advanced Installer Project. As a very basic minimum you have now successfully integrated the licensing feature into your project.
NB. Unless you have a copy of the AI Licensing.dll in your debug folder of your project you will encounter a build error when compiling your project. The simple answer to this is to leave this line commented out until you are finally ready to incorporate the project into the final msi. At this point uncomment the line and save the project. Then use Advanced Installer to import the project and select the release version and opt to build the project. It will then build without error.

If your application is for x86 platforms, it is recommended to follow these steps:
- right-click the VB project in Visual Studio and select "Properties"
- click on the "Compile" button
- click on the "Build Events" button
- add this post build event:

call "$(DevEnvDir)..\Tools\vsvars32.bat"
editbin.exe /NXCOMPAT:NO "$(TargetPath)"

This will disable the DEP and it is not required for x64 platforms.


Hope this helps

Dom
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: New License Feature

Hi,

Additionally, you can read the licensing how-to to better understand what to add into your application.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”