VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This very simple, yet useful code is a password program, using the registry to keep the password. S

by Evil X Genie (1 Submission)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 11th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This very simple, yet useful code is a password program, using the registry to keep the password. So everytime you open the program, it will

API Declarations


'PLACE ALL THIS INTO A NEW MODULE or IN Declarations OF YOUR FORM

Public Sub CreateKey(Folder As String, Value As String)

Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value

End Sub

Public Sub CreateIntegerKey(Folder As String, Value As Integer)

Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value, "REG_DWORD"


End Sub

Public Function ReadKey(Value As String) As String

'READ FROM WINDOWS REGISTRY
'.........................
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
r = b.RegRead(Value)
ReadKey = r
End Function


Public Sub DeleteKey(Value As String)
'DELETE VALUES FROM WINDOWS REGISTRY
'-----------------------------------
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub


Rate This very simple, yet useful code is a password program, using the registry to keep the password. S




Dim Read
Read = ReadKey("HKEY_CURRENT_USER\Software\VBPW\pw")

'Check if the registry key exist, if it doesn't, let's create it!

  If Read = Null Then
  CreateKey "HKEY_CURRENT_USER\Software\VBPW\pw", "123"
  End If

'Let's see if the password the person tryed is currect.

  If Text1.Text = Read Then
  Label1.Caption = "Currect Password!"
  Else
  Label1.Caption = "Incurrect Password!"
  End If
  
'Here is how to delete the key from the registry.
'DeleteKey "HKEY_CURRENT_USER\Software\VBPW\pw"

Download this snippet    Add to My Saved Code

This very simple, yet useful code is a password program, using the registry to keep the password. S Comments

No comments have been posted about This very simple, yet useful code is a password program, using the registry to keep the password. S. Why not be the first to post a comment about This very simple, yet useful code is a password program, using the registry to keep the password. S.

Post your comment

Subject:
Message:
0/1000 characters