Jump to content
Wav3

[VB6] WinRar Add / Extract

Recommended Posts

Functiile de baza pentru crearea si extragerea unei archive .rar sau .zip.

Creare arhiva :

Public Function WArchive(FileOrFolderPath As String, DestinationArchivePath As String, Optional Level As Integer = 3, Optional ReplaceAlreadyExistingArchive As Boolean = False, Optional Password As String, Optional EncryptFileNames As Boolean = True) As Boolean
If Not Password = vbNullString Then
If EncryptFileNames = True Then
Password = " " & Chr(34) & "-hp" & Password & Chr(34)
Else
Password = " " & Chr(34) & "-p" & Password & Chr(34)
End If
End If

If ReplaceAlreadyExistingArchive = True And Dir(DestinationArchivePath) <> vbNullString Then Kill DestinationArchivePath

WArchive = ShellWait(Environ("programfiles") & "\WinRAR\WinRar.exe a -m" & Level & " " & Chr(34) & DestinationArchivePath & Chr(34) & Password & " " & Chr(34) & FileOrFolderPath & Chr(34), False)
End Function

Extragere din arhiva :

Public Function WExtract(ArchivePath As String, DestinationPath As String, Optional KeepFolderStructure As Boolean = True, Optional Password As String) As Boolean
If Not Password = vbNullString Then Password = " " & Chr(34) & "-p" & Password & Chr(34)

If KeepFolderStructure = True Then
WExtract = ShellWait(Environ("programfiles") & "\WinRAR\WinRar.exe x " & Chr(34) & ArchivePath & Chr(34) & Password & " " & Chr(34) & DestinationPath & Chr(34), False)
Else
WExtract = ShellWait(Environ("programfiles") & "\WinRAR\WinRar.exe e " & Chr(34) & ArchivePath & Chr(34) & Password & " " & Chr(34) & DestinationPath & Chr(34), False)
End If
End Function

Download : GirlShare - Download WinrarCommands.rar

Proiectul mai contine o functie ShellWait al carui cod nu imi apartine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...