:)
How to encrypt and decrypt a file using vb6.0
Pls. mail me sonn,,,
Thanx in Advance...
Printable View
:)
How to encrypt and decrypt a file using vb6.0
Pls. mail me sonn,,,
Thanx in Advance...
If you ahve Windows 2000 or greater, you can use the Encrypt and Decrypt API functions
VB Code:
Private Declare Function EncryptFile Lib "ADVAPI32" Alias "EncryptFileA" (ByVal lpFileName As String) As Boolean Private Declare Function DecryptFile Lib "ADVAPI32" Alias "DecryptFileA" (ByVal lpFileName As String, ByVal dwReserved As Long) As Boolean Const mFile = "c:\test.txt" Private Sub Form_Load() 'KPD-Team 2000 'URL: [url]http://www.allapi.net/[/url] 'E-Mail: [email][email protected][/email] Encrypt mFile End Sub Sub Encrypt(sFile As String) If EncryptFile(mFile) Then MsgBox "The file's succesfully encrypted. Log in as another user and try to access this file." End If End Sub Sub Decrypt(sFile As String) If DecryptFile(mFile, 0) = True Then MsgBox "The file's succesfully decrypted." End If End Sub
you can also use ur own encryption logic like adding some number to the ascii value etc.
btw,this is answered in some other thread also.