ewfarrell
Posts: 2
Joined: Mon Jul 04, 2011 5:06 pm

trial / licensing using VB6

I'm trying to incorporate trial/license functions into my VB6 installation. I've adapted one of the sample vb.net DLL calls as follows (thanks to this forum):

Private Declare Function DisplayRegistration Lib "Trial.dll"_
Alias "DisplayRegistrationStr" (ByVal aKeyCode As String,_
ByVal aHWnd As Long) As Long

Interrogating the license library to get licensing information has me stumped, though. In your code samples, the GetPropertyValue function uses VB.net's StringBuilder class and the UInt datatype as parameters. Are there VB6 equivalents to these, or are there workarounds? I want to use my own UI forms use the library to handle registration and status queries.

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

Re: trial / licensing using VB6

Hi,

Did you try following our Add trial support to your VB application tutorial? It should work for VB6 applications.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ewfarrell
Posts: 2
Joined: Mon Jul 04, 2011 5:06 pm

Re: trial / licensing using VB6

Yes, I went over this tutorial thoroughly. The code sample given is for vb.net and cannot be used in vb6 without modification. However, I was able to modify at least one of the function calls thanks to the tips in this thread:

http://www.advancedinstaller.com/forums ... vb6#p24399

However, I cannot figure out how to modify the calls in this tutorial:

http://www.advancedinstaller.com/user-g ... perty.html

Modifying this function call:

<DllImport("Trial.dll", EntryPoint:="GetPropertyValue", CharSet:=CharSet.Unicode)> _
Private Shared Function GetPropertyValue(ByVal aPropName As String, ByVal aResult As StringBuilder, ByRef _
aResultLen As UInt32) As UInteger
End Function

for use in VB6 involves use of the StringBuilder class that is not native to vb6. Is there a workaround for vb6 apps? I am also a little uneasy with the UInt32 datatype. The closest VB6 seems to have is Long Integer, but Long Integer is signed and UInt32 is not.

Thanks
rzeegers
Posts: 2
Joined: Mon Jun 03, 2013 2:33 pm

Re: trial / licensing using VB6

ewfarrell wrote:Yes, I went over this tutorial thoroughly. The code sample given is for vb.net and cannot be used in vb6 without modification. However, I was able to modify at least one of the function calls thanks to the tips in this thread:

http://www.advancedinstaller.com/forums ... vb6#p24399

However, I cannot figure out how to modify the calls in this tutorial:

http://www.advancedinstaller.com/user-g ... perty.html

Modifying this function call:

<DllImport("Trial.dll", EntryPoint:="GetPropertyValue", CharSet:=CharSet.Unicode)> _
Private Shared Function GetPropertyValue(ByVal aPropName As String, ByVal aResult As StringBuilder, ByRef _
aResultLen As UInt32) As UInteger
End Function

for use in VB6 involves use of the StringBuilder class that is not native to vb6. Is there a workaround for vb6 apps? I am also a little uneasy with the UInt32 datatype. The closest VB6 seems to have is Long Integer, but Long Integer is signed and UInt32 is not.

Thanks
@ewfarrell, Did you ever got it to work? If so, can you please share it with us. We're struggling with it for days now.

Hope to hear from you.

Cheers

Return to “Common Problems”