Results 1 to 5 of 5

Thread: problem

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2000
    Posts
    33

    Question

    if i create a license code how can i put that in a file that is code

    licencode1 = bjorn
    licencode2 = test
    licencode3 = bjorn

    like the user have the licenscode2

    so if thy start the program thy have to enter the code
    put i thy restart the program the window will popup again
    but i want i ownely 1 time if thy have insert the code

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ...

    need further clarification

    ???
    so if thy start the program thy have to enter the code
    put i thy restart the program the window will popup again
    but i want i ownely 1 time if thy have insert the code

    ????

  3. #3
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    He wants to make a simple register programme that only askes for the password once.

    Save the register information to a file or to the registry. Then in form_load, check if its there. If it is, then don't show the register dialog.

  4. #4
    Guest
    Maybe something like this?


    Inputbox will come up asking the user to enter a password (or whatever you want) and won't go away until the user enters something. GetSettings will retrieve the value, if nothing is there, than it will ask for the user to enter the password. SaveSettings saves the password to the Registry which is the best place to store stuff.

    I haven't tested this code, but I am sure it will work.

    Code:
    Private Sub Form_Load()
    '1=Password entered
         RetVal = GetSetting("MyApp", "Startup", "Password")
         If RetVal <> 1 Then
              Do
              x = InputBox("Password?")
              If x = "Bjorn" Then 
                   SaveSetting "MyApp", "Startup", "Password", 1
                   Exit Do
              End If
              Loop
         End If
    End Sub

  5. #5
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ....ok

    If for internal use, registry or ini file would be ok..
    but for commercial progs, people would break it in a sec

    but for what it's worth:

    to answer the original question

    I'd use an ini file with sections
    [Licenses]
    Code1 = bjorn
    Code2 = test
    Code3 = whatever


    WritePrivateProfileString("Licenses", "Code1", _
    YourActualLicenseCode, NameOfIniFile)

    define
    Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

    and to read from the file, use
    Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

    or use the registry but they sometimes get corrupted...

Posting Permissions

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



Click Here to Expand Forum to Full Width