English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to add a kinda license feature to my program (just to test it) when the user has to type in say a code thats 24 characters long with numbers and letters and if they do that it then enables the form.
I know how to enable the form but dont know how to do the license key thing, can anyone help?
Links or code please

2007-02-19 06:06:36 · 4 answers · asked by sbraidley 3 in Computers & Internet Programming & Design

4 answers

Use a standard login form, but remove the password box and use the username box for License Code.

In the click event it's just

IF txtCode.text = then
frmMain.enabled = TRUE
END IF

That will work if you want the same code for every copy of your program. If you want to generate individual codes then you'll need to install a small .txt file with your program install. (I use .dat instead of .txt because it's less obvious to the casual onlooker) Then you open that file and read it to compare to the string from the users login box

Open (app.path & code.dat) for INPUT as #1
Input #1, strCode
IF txtCode.text = strCode then
frmMain.enabled = TRUE
END IF
Close #1

2007-02-19 06:17:32 · answer #1 · answered by rod 6 · 1 1

http://www.codetoad.com/vb_license_key.asp

Here is a VB class that generates license keys - should be pretty easy to rewrite in VB.NET

There are alot of things to keep in mind when trying to secure software with a license - for example, how are you going to store whether the software has been unlocked? If it is something simple like a true/false value in the registry, your users will be able to find that and change it themselves. Also, if you do the computation on the fly and set a variable in memory, and give an "invalid key" error message, then anyone can use a debugger to step through your program and read the values from memory to see what algorithm you are using to validate the key.

The best way to avoid piracy is to keep a good relationship with your customers and your prices reasonable.

2007-02-19 14:39:44 · answer #2 · answered by Rex M 6 · 2 1

Well, first you need a unique code, otherwise if you only had one code then people could just post it online and unlock your software. Here's a way you could generate a code:

Take the computer name, and the time when the code was generated as inputs to output a unique alphanumeric sequence. If the user wants to unlock your program, they have to contact you and give them this code. You then write a program that can generate another code given this code, return the generated code back to them. They then input that code and your program checks it against its auto-generated code to see if they match (after being decrypted).

That's the basic idea, their's a cryptographic namespace in the .net framework that might help with encrypting / decrypting keys.

2007-02-19 14:27:44 · answer #3 · answered by Pfo 7 · 0 1

check out http://www.pscode.com for great sample codes.

2007-02-19 17:02:09 · answer #4 · answered by Richard H 7 · 0 1

fedest.com, questions and answers