|
-
Nov 29th, 2000, 12:52 PM
#1
Thread Starter
Member
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
-
Nov 29th, 2000, 02:11 PM
#2
Fanatic Member
...
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
????
-
Nov 29th, 2000, 03:13 PM
#3
Hyperactive Member
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.
-
Nov 29th, 2000, 03:58 PM
#4
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
-
Nov 29th, 2000, 04:00 PM
#5
Fanatic Member
....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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|