VB - A Program Registration Scheme-VBForums
Page 1 of 5 1234 ... LastLast
Results 1 to 40 of 175

Thread: VB - A Program Registration Scheme

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844

    VB - A Program Registration Scheme

    Attached is a project (actually two projects) that show one way of having the user register his copy of your program. This is the way it works:

    • The main application displays a registration screen with two options: "Register" and "Request Registration Key".
    • If the user selects "Register" a new screen is shown that asks the user for his name and tells him that if he continues it will generate an e-mail message to you (via MAPI) and that you will send him the registration key by return e-mail. If he continues, the program gets his hard drive serial number and includes it in the e-mail to you.
    • Once you receive the registration request email, you use the second project (GenKey) to generate a registration key by way of a simple algorithm that you can change based on the hard drive serial number. Just remember that the algorithm is in both projects and it must be exactly the same in both.
    • You then send the registration key back to the user and have them enter it in the second part of the registration screen which writes the key to the registry.
    • When they start the main program again it uses the same algorithm to see if the registration key in the Registry matches the HD serial number. If it matches the program starts (see Notes below). If it doesn't match or if there is no registry entry, the program does not start or you could arrange it so that it starts with only a few demo functions available.


    Notes:
    • Your main form must be shown using vbModal.
    • You will need to modify the program to change the constant named EMAIL to your e-mail address.
    • You should change the registration key algorythm. See CalcRegKey in modProtect and Sub Main in modGenKey. The changes should be the same in both places.
    Attached Files Attached Files

  2. #2
    New Member
    Join Date
    Feb 2003
    Location
    Arlington, TX
    Posts
    11
    Pretty neat, I did this a while back for an application of mine that I never got around to releasing...I really want to fix a few bugs in it and then release it to the public. It is of great help to me and my friends.

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    55
    Just one small bug I found in the keygen project, which I thought I should share in case anyone is using this technique to create keys -- on my PC, the Serial Number generated was a minus number. If I put that in the keygen, an invalid procedure call error occurred.

    To fix:

    Change the following line:

    VB Code:
    1. strLicenseKey = CStr(Int(3456 * Sqr(lngSerialNum / 5)))

    to:

    VB Code:
    1. strLicenseKey = CStr(Int(3456 * Sqr(Abs(lngSerialNum) / 5)))

    This forces the number to be turned from minus figures to a positive number, and generates the correct key.

    Cheers

  4. #4
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Hey Martin,
    It reads my hard drive serial number as '0' is that right?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  5. #5

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Originally posted by evexa
    Hey Martin,
    It reads my hard drive serial number as '0' is that right?
    I doubt it. Check your code against mine and if you can't find anything wrong, zip up your code and I'll take a look at it.

  6. #6
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by MartinLiss
    I doubt it. Check your code against mine and if you can't find anything wrong, zip up your code and I'll take a look at it.
    Thing is I never changed your code - I just was testing it.

    Maybe i need to change a setting somewhere?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  7. #7

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Then I don't know what is going on since 187 other people have downloaded it and no one that I know of has experienced your problem. I know the code works on both NT4 and XP. What is your operating system?

  8. #8
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by MartinLiss
    Then I don't know what is going on since 187 other people have downloaded it and no one that I know of has experienced your problem. I know the code works on both NT4 and XP. What is your operating system?
    XP - I must be special
    Maybe because of the HD - because its a laptop? Im guessing here...
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  9. #9
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Oh - another thing - I get this error :

    Can't show non-modal form when modal is displayed

    Probably has to do with this:
    VB Code:
    1. Public Sub Main()
    2.  
    3.     Dim frm As Form
    4.    
    5.     GetAppEnvironment
    6.    
    7.     If Not gRegClass.Registered Then
    8.         frmRegister.Show vbModal
    9.     Else
    10.         frmDone.Show vbModal
    11.     End If
    12.    
    13.     For Each frm In Forms
    14.         Unload frm
    15.         Set frm = Nothing
    16.     Next
    17.    
    18.     End
    19.  
    20. End Sub

    How do I make it so that it lets me open the other forms in the project ?
    Cheers xxxx
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  10. #10

  11. #11
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by MartinLiss
    I don't know what's happening on your PC. What option do you choose when you see the form that says "In order for you to be able to use the full funtionality..."?
    Hm - well it wont let me open that way anymore because i registered myself but I dont remember choosing an option at all! =/
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  12. #12
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    I made it go back to that screen - i chose to request a registration key - bad?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  13. #13

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Are you comfortable with editing the Registry? If so, let's start over.
    • Run RegEdit
    • Go To HKEY_CURRENT_USER|Software|VB and VBA Program Settings
    • Find the Protect folder and delete it
    • In the program change Public Const EMAIL = "xxx@yyy.zzz" to reflect your email address
    • Run the program and select Register
    • Let me know what happens at that point.

  14. #14
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Cool - first time editing the registry but did as asked.
    Now when i click register it goes to the whole registration form this - where you enter your key etc....

    WHat now?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  15. #15

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    If you've modified the email address in the application like I suggested above, then

    • Choose the Request Registration Key option.
    • That should result in you receiveing an email containing your HD serial number.
    • Take that serial number and run it through the GenKey application.
    • GenKey will give you the registration key.
    • Run the Protect application again, selecting the Register option
    • Enter the key and you're done.


    BTW, both applications contain an algorythm that starts strLicenseKey = CStr(Int. You'll probably want to change that in both applications (the same way) so that your calculation will be different from other people who use this registration scheme.

  16. #16
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135
    I think that basing any registration scheme off any one piece of hardware is a very bad idea, and extremely bad for business.

    I would hate to think that I couldn't reinstall my Visual Studio because my hard drive died, or I upgraded to a larger one and needed to reinstall......

  17. #17

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Originally posted by JasonC
    I think that basing any registration scheme off any one piece of hardware is a very bad idea, and extremely bad for business.

    I would hate to think that I couldn't reinstall my Visual Studio because my hard drive died, or I upgraded to a larger one and needed to reinstall......
    I would call it a disadvantage rather than a bad idea. Yes, if you are going to have thousands of users then you might want to use some other scheme, but unfortunately not many of us will face that "problem". For most of us, if one of our users needs to replace their hard drive, all they need to do is to request a new registration key. I have not had to do that for anyone yet, but just in case, I keep a record of my users with names, HD serial numbers, date requested, etc.

  18. #18

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Originally posted by evexa
    Lol its still saying '0' is my HD number =)
    and it still says:
    cannot show non modal form when modal is diplayed.
    Sorry then, but without your PC in front of me I can't tell what's going on.

  19. #19
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    I will work on it - but before i delve could you tell me what this piece of script does?

    Public Sub Main()

    Dim frm As Form

    GetAppEnvironment

    If Not gRegClass.Registered Then
    frmRegister.Show vbModal
    Else
    frmDone.Show vbModal
    End If

    For Each frm In Forms
    Unload frm
    Set frm = Nothing
    Next

    End

    End Sub


    thank you xxxx
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  20. #20

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    VB Code:
    1. Dim frm As Form ' Create a Form object
    2.    
    3.     GetAppEnvironment ' Calls the routine that finds out if the user is registered
    4.    
    5.     If Not gRegClass.Registered Then ' Registered is a boolean property of theCRegister class
    6.         frmRegister.Show vbModal ' If the user is not registered then the register form is displayed
    7.     Else
    8.         frmDone.Show vbModal ' In this app if the user is registered then frmDone is displayed.
    9.                              ' In your app you would probably replace frmDone with your main form
    10.     End If
    11.    
    12.     For Each frm In Forms ' Loop through all the forms...
    13.         Unload frm        ' and unload them...
    14.         Set frm = Nothing ' and set them to Nothing
    15.     Next
    16.    
    17.     End ' 99.99999% of the time not needed, but it can't hurt after you've unloaded your forms.

  21. #21
    Lively Member
    Join Date
    Feb 2003
    Location
    EGYPT
    Posts
    103
    nice idea but you know that there's no way to secure your prog's it will be cracked whatever you do

  22. #22
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by cgi
    nice idea but you know that there's no way to secure your prog's it will be cracked whatever you do
    There is no way to stop that?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  23. #23

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    Consider this. While a thief can break a window to get into a house even though the door may be locked, he will most likely check the doors first and enter the house that is unlocked. The point is that while no security method is foolproof, it still makes sense to "lock the door".

  24. #24
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by MartinLiss
    Consider this. While a thief can break a window to get into a house even though the door may be locked, he will most likely check the doors first and enter the house that is unlocked. The point is that while no security method is foolproof, it still makes sense to "lock the door".
    Agreed.
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  25. #25
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Other side of town from si_the_geek
    Posts
    7,171
    Originally posted by MartinLiss
    Consider this. While a thief can break a window to get into a house even though the door may be locked, he will most likely check the doors first and enter the house that is unlocked. The point is that while no security method is foolproof, it still makes sense to "lock the door".
    Excellent point


    Has someone helped you? Then you can Rate their helpful post.

  26. #26
    Member
    Join Date
    May 2003
    Posts
    59
    Why not use the motherboard SN?
    VB Code:
    1. 'Add a reference to Microsoft WMI Scripting Library
    2.  
    3. Private Sub Form_Load()
    4.  
    5.     Dim List
    6.     Dim Object
    7.     Dim WMI
    8.  
    9.     Set WMI = GetObject("WinMgmts:")
    10.     Set List = WMI.InstancesOf("Win32_BaseBoard")
    11.  
    12.     For Each Object In List
    13.         MsgBox Object.SerialNumber
    14.     Next
    15.    
    16.     Unload Me
    17.    
    18. End Sub

  27. #27

  28. #28
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Originally posted by MartinLiss
    Doesn't work on my XP PC.

    So the code doesnt work on XP full stop?

    Is there anything that is not OS specific - maybe the motherboard SN as the gentleman above suggested?
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  29. #29
    Member
    Join Date
    May 2003
    Posts
    59
    Ah yes... the problem is not OS specific; Some hardware manufacturers don't embed serial number information in their parts.

    As far as evexa's drive returning a 0, this is quite possible. There are utilities such as those available from Sysinternals and PowerQuest (or even DOS's Debug) to edit or completely remove the VSN.

    As an alternative, a combination of the Motherboard, Processor, BIOS, and Disk serial numbers could still be used. The formula to manipulate the strLicenseKey would have to be changed, but that should be fairly straight forward.

    For JasonC, simply exclude the Disk serial number so he can swap out his hard drive

    And for cgi, he's right... if someone wants something bad enough, they'll do anything to get it. But your "locked door" analogy is right on the money... Locks were designed to keep honest people honest.

    Use it if you like it... if not, at least you have stimulated our thought processes.

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.    Dim List
    4.    Dim Msg
    5.    Dim Object
    6.    
    7.    On Local Error Resume Next
    8.    
    9.    Set List = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_BaseBoard")
    10.    For Each Object In List
    11.       Msg = Msg & "Motherboard Serial Number: " & Object.SerialNumber & vbCrLf
    12.    Next
    13.  
    14.    Set List = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_Processor")
    15.    For Each Object In List
    16.       Msg = Msg & "Processor Unique ID: " & Object.UniqueID & vbCrLf
    17.    Next
    18.  
    19.    Set List = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_BIOS")
    20.    For Each Object In List
    21.       Msg = Msg & "BIOS Serial Number: " & Object.SerialNumber & vbCrLf
    22.    Next
    23.  
    24.    Set List = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_LogicalDisk")
    25.    For Each Object In List
    26.       Msg = Msg & "Disk Serial Number: " & Object.VolumeSerialNumber & vbCrLf
    27.    Next
    28.  
    29.    MsgBox Msg
    30.    Unload Me
    31.  
    32. End Sub

  30. #30
    Fanatic Member evexa's Avatar
    Join Date
    Apr 2003
    Location
    USA
    Posts
    609
    Its a good idea to use all those serial numbers - but- asnd this is a newbie talking... What if it wasnt able to grasp one of the numbers - or the number changes - like for example if they swap hard drives... maybe its better just to use ONE source for SNs
    Trust no one

    ----------------------------------------
    http://www.eccentrix.com/members/xeaudrey/exanegotium.html
    http://www.eccentrix.com/members/xeaudrey/

  31. #31
    Member
    Join Date
    May 2003
    Posts
    59
    Here's an article on how Micro$oft does it; http://www.extremetech.com/article2/0,3973,10426,00.asp

  32. #32
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    Martin, this is quite a nice piece of source. But I have a questionsfor you, ok well
    Once the program is registered, will it always come up?,

  33. #33

  34. #34
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    Yea thats what I ment

  35. #35
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    Ok, I need some help using this. I made the downloaded file a .exe. And I registered it, but then when I got to the happy face screen, and pressed ok it exited. Then I thought okt hats registered but when I open it again I have to register it again

  36. #36

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    32,844
    It's got to have something to do with the way you modified the SaveSetting and GetSetting calls in the program. There are 2 places where SaveSetting is used and 3 places where GetSetting is used. Can you show what you did in those 5 places please?

  37. #37
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    I didnt do any editing! Im not to good with Vb lol

  38. #38

  39. #39
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    Its too big, shall i email it to you?

  40. #40
    Lively Member
    Join Date
    Dec 2003
    Posts
    121
    Or maybe I could upload the main page?

Page 1 of 5 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.