Results 1 to 3 of 3

Thread: Encrypt and Decrypt using vb6.0

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    chennai, Tamil Nadu, India.
    Posts
    84

    Encrypt and Decrypt using vb6.0



    How to encrypt and decrypt a file using vb6.0

    Pls. mail me sonn,,,

    Thanx in Advance...
    S.Desikan

  2. #2
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Utah
    Posts
    397
    If you ahve Windows 2000 or greater, you can use the Encrypt and Decrypt API functions

    VB Code:
    1. Private Declare Function EncryptFile Lib "ADVAPI32" Alias "EncryptFileA" (ByVal lpFileName As String) As Boolean
    2. Private Declare Function DecryptFile Lib "ADVAPI32" Alias "DecryptFileA" (ByVal lpFileName As String, ByVal dwReserved As Long) As Boolean
    3. Const mFile = "c:\test.txt"
    4. Private Sub Form_Load()
    5.     'KPD-Team 2000
    6.     'URL: [url]http://www.allapi.net/[/url]
    7.     'E-Mail: [email][email protected][/email]
    8.     Encrypt mFile
    9. End Sub
    10. Sub Encrypt(sFile As String)
    11.     If EncryptFile(mFile) Then
    12.         MsgBox "The file's succesfully encrypted. Log in as another user and try to access this file."
    13.     End If
    14. End Sub
    15. Sub Decrypt(sFile As String)
    16.     If DecryptFile(mFile, 0) = True Then
    17.         MsgBox "The file's succesfully decrypted."
    18.     End If
    19. End Sub

  3. #3
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    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.
    Regards

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