How could I make a cd-key asking form?

powerniso

Registered User.
Local time
Today, 22:40
Joined
Sep 4, 2009
Messages
11
I've made a simple program in access that helps making sales, incomes, cash registry and so on. But I need to add so-named CD-KEY to use the program depending on individual machine ID or anything else that is individual on every PC to not allow others to copy my program without permission. Want to make a form that will ask a CD-KEY on first open of program on every machine, then if cd-key is correct, it will never ask it again unless it is copied to another pc. I think it is possible by making the program read the machine id of pc, then xor it with appropriate number, and the end value is the cd-key. Then it will give the user his own machine id in a special format and will ask to enter the correct cd-key. If the cd-key is correct, it will save the cd-key entered by user and will check the entered cd-key on every open, if correct, will open the main form, if not will ask for the cd-key. As I don't know anything about the VBA, please help me with this situation. P.S. I've made my program only using queries and macros. P.S.S. I'm sorry if I made any mistakes in sentences, as I'm from Azerbaijan and don't speak English so well.
 
Hi

well, have you got the code to read the machine ID? Have you created any code to do what you want? Is it just guidance on implimenting your code to a form or do you actually want someone here to just do it for you?

This place is about input and advice. You would probably better offering what you have already done and asking advice on that rather that thinking someone would just do it for you...

It is a complex requirement. Have you tried redbaron? Something like this really needs to be purchased unless you're good enough to create it yourself. In which case, you wouldn't be asking.


Nidge
 
I have already made that code, I need some advise in that way to find out the easier way...
 
I have already made that code, I need some advise in that way to find out the easier way...

Hi,

what "code" have you made? all of it? some of it? the part that makes the key? you are a little hazy in your descriptions my friend.

if you have the code, you could set either a Db property or a Reg key. either way, your startup would be the same. you would need ( in laymans term )-

On startup, check either reg key or property

Code:
Public Sub GetValidation()
Dim strCodeKey As String

strCodeKey = 'My Validation code from registry or Db Property

If strCodeKey <> "" Then
'you are validated move to next routine

Call MyNextRoutine
Exit Sub

Else

MsgBox ("Your Program Is Not Validated")
Call NewValidationRoutine ' or what you use to create the CD key

End If

your code needs to check for the key value in the property or registry.
if it is there, the key has already been inserted and move on

if it is NOT there, add the key however you want.

HTH


nidge
 
Hi,

what "code" have you made? all of it? some of it? the part that makes the key? you are a little hazy in your descriptions my friend.

NigelShaw, thanks a lot for your reply. But I don't want to check the registry as my program is not so rare thing. I want only put some trouble in front of those who will simply copy my program to other pc-s. Hence I made a simple amateur code below:
Private Sub Form_Open(Cancel As Integer)

Dim t As String, i As Integer, f, r As Double
Dim fs, d, k1

Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
k1 = d.SerialNumber
f = 0
name1 = name2
surname1 = surname2

If (Eval("([Forms]![ad]![name2] Is Null) Or ([Forms]![ad]![surname2] Is Null)")) Then
name1 = "Any"
surname1 = "User"
End If
For i = 1 To Len(name1 & surname1)
t = Mid(UCase(name1 & surname1), i, 1)
Select Case t
Case "A": r = 10
Case "B": r = 11
Case "C": r = 12
Case "D": r = 13
Case "E": r = 14
Case "F": r = 15
Case "G": r = 16
Case "H": r = 17
Case "I": r = 18
Case "J": r = 19
Case "K": r = 20
Case "L": r = 21
Case "M": r = 22
Case "N": r = 23
Case "O": r = 24
Case "P": r = 25
Case "Q": r = 26
Case "R": r = 27
Case "S": r = 28
Case "T": r = 29
Case "U": r = 30
Case "V": r = 31
Case "W": r = 32
Case "X": r = 33
Case "Y": r = 34
Case "Z": r = 35
End Select
f = f + r
Next i
key1 = Val(k1) + f
If key2 = Round(key1 / 5050505 * 99978877, 0) Then
DoCmd.Close acForm, "ad"
DoCmd.OpenForm "main", acNormal, "", "", , acDialog
Else:
DoCmd.GoToControl "name1"
End If
Set fs = Nothing
Set d = Nothing
End Sub
Private Sub name1_AfterUpdate()
Dim t As String, i As Integer, f, r As Double
Dim fs, d, k1

Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
k1 = d.SerialNumber
f = 0
For i = 1 To Len(name1 & surname1)
t = Mid(UCase(name1 & surname1), i, 1)
Select Case t
Case "A": r = 10
Case "B": r = 11
Case "C": r = 12
Case "D": r = 13
Case "E": r = 14
Case "F": r = 15
Case "G": r = 16
Case "H": r = 17
Case "I": r = 18
Case "J": r = 19
Case "K": r = 20
Case "L": r = 21
Case "M": r = 22
Case "N": r = 23
Case "O": r = 24
Case "P": r = 25
Case "Q": r = 26
Case "R": r = 27
Case "S": r = 28
Case "T": r = 29
Case "U": r = 30
Case "V": r = 31
Case "W": r = 32
Case "X": r = 33
Case "Y": r = 34
Case "Z": r = 35
End Select
f = f + r
Next i
key1 = Val(k1) + f
DoCmd.GoToControl "surname1"
Set fs = Nothing
Set d = Nothing
End Sub
Private Sub okey_Click()
If key2 = Round(key1 / 5050505 * 99978877, 0) Then
name2 = name1
surname2 = surname1
DoCmd.Close acForm, "ad"
DoCmd.OpenForm "main", acNormal, "", "", , acDialog
Else:
MsgBox "WRONG CODE !", vbOKOnly, "ERROR"
DoCmd.Quit acQuitSaveAll
End If
End Sub
Private Sub surname1_AfterUpdate()
Dim t As String, i As Integer, f, r As Double
Dim fs, d, k1

Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
k1 = d.SerialNumber
f = 0
For i = 1 To Len(name1 & surname1)
t = Mid(UCase(name1 & surname1), i, 1)
Select Case t
Case "A": r = 10
Case "B": r = 11
Case "C": r = 12
Case "D": r = 13
Case "E": r = 14
Case "F": r = 15
Case "G": r = 16
Case "H": r = 17
Case "I": r = 18
Case "J": r = 19
Case "K": r = 20
Case "L": r = 21
Case "M": r = 22
Case "N": r = 23
Case "O": r = 24
Case "P": r = 25
Case "Q": r = 26
Case "R": r = 27
Case "S": r = 28
Case "T": r = 29
Case "U": r = 30
Case "V": r = 31
Case "W": r = 32
Case "X": r = 33
Case "Y": r = 34
Case "Z": r = 35
End Select
f = f + r
Next i
key1 = Val(k1) + f
DoCmd.GoToControl "key2"
Set fs = Nothing
Set d = Nothing
End Sub
 
I'm not quite understanding how you think this would work...

The user installs it on one PC
It challenges them for a piece of information
They enter the information
The program starts working

The user installs it on a second PC.
How does the second PC know it's not the first ever install?

In order to make this work, you'd need to do something like one of these schemes:

-Write something back to the install media (check for this on installation and refuse to run a second time, or on a different machine). Not going to work if your program is distributed on CD, but might be possible if you distribute it on a USB memory stick

-Generate a code during installation, get the user to send this to you (or get the program to send it to a server at your company), use the code they sent to generate a unique unlock code, sent back to them to unlock the program.
This relies on you managing the process (it's no good if someone wants to install the program and you are not there to generate the unlock code, and how will you keep track of how many copies each customer is allowed to run?)

I can't think of any way to make an installer that will generate a unique key that will only permit the first attempt at installation. How would it be able to tell the difference between the first and second attempts at installation?
 
AtomicShrimp,

You are quite right, but I don't need to sell it forever and that program is designed for limited group of people in my town only (and my town is not so big). Hence, I will sell each copy for one pc only, for the 2nd - additional pay, and so on. So, I will myself keep track of customers who will use my program. However, thanks for your ideas. They helped me to look at my project from different point of view..
 
Hi

but it can still be installed on unlimited amount of computers regardless of the size of your town. Let's say just one of those people is not so trustworthy and posts it to the Internet. Of you can't control the licencing which at the minute you can't, there's absolutely no point in what you are doing.

I would still recommend an advanced option. Peterssoftware has a food licencing tool. Personally, I would have my program check for a licence externally from your application.

Currently, if each user distributed it to 1 friend and each one of those gave it to 1 friend, it wouldn't take very long before hundreds of copies are being used without being paid for.


Nidge
 

Users who are viewing this thread

Back
Top Bottom