|
-
Nov 28th, 2003, 11:41 AM
#1
Thread Starter
Lively Member
Encrypt and Decrypt using vb6.0
How to encrypt and decrypt a file using vb6.0
Pls. mail me sonn,,,
Thanx in Advance...
-
Nov 28th, 2003, 12:10 PM
#2
Hyperactive Member
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]
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
-
Nov 28th, 2003, 01:06 PM
#3
Hyperactive Member
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.
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
|