Licence Verification

  • Thread starter Thread starter alanford
  • Start date Start date
A

alanford

I have built a module to ensure that my managers follow the correct
procedure for their risk assessment, now the company has shown an
interest in my work, however I would like to limit the access to the
program in the following manner if possible.
During install I can input a string in LOCALMACHINE as a licence number
I need to build a workbook called main.xls wich will run once after
intall with a inputbox which will look into localmachine and read the
string, after verification that the string matches it will rename
itself as main.old and rename another file main2.xls as main.xls. if
the string does not match a msgbox would prompt the user to contact me
to obtain a installable version of the program with a valid licence. I
hope this makes sence. thank you for your help.

Alan
 
I thought we all did this for free? Actually I found this interesting and
would like to read any answers you get.
Thanks
 
Don't know about all the pfaffing about with the main.xls, and not really
understanding how you would validate the licence value, but you could put
this in the workbook open event (ThisWorkbook code module). It checks
whether there is a licence key, so just change the registry key to suit.

Private Sub Workbook_Open()
Dim oWSH As Object
Dim sResult

Set oWSH = CreateObject("WScript.Shell")

On Error Resume Next
'Read language registry key information
sResult = oWSH.RegRead("HKLM\Software\Alan\myApp\Licence\")
If Err.Number <> 0 Or sResult = "" Then
MsgBox "No valid licence" & vbCrLf & _
"Contact Alan for a valid version"
Me.Close savechanges:=False
End If
Err.Clear

On Error GoTo 0

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
oWSH.RegRead

Interesting, first time I have seen this. Any reason why you prefer this
above
reading the registry with the Windows API?

RBS
 
Brevity of code.

In my production stuff I use the APIs, in case there is a downer on
installing WSH.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thank you I have achieved what I set out to do, but only thank to you.
this is a breakthrough for me I'll never thank you enough.

Brilliant.

Alan
 
David
this is going to be for free as I have developed this for my company
but I just want to avoid people copying my work and distributing it as
theirs. Now that annoys me immensly.

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top