'申明 Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _ (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, _ ByVal bFailIfExists As Long) As Long Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _ (ByVal lpFileName As String) As Long
'程序中 Dim Rarexe As String Rarexe = GetKeyValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Classes\WinRAR\shell\open\command", , REG_SZ) Rarexe = Mid(Rarexe, 2, InStr(Rarexe, ".exe") + 2)
Dim FileString As String 'Shell指令中的字符串 CopyFile 源文件名, 中间文件名, 0 '0:可以重写 FileString = Rarexe & " A " & 压缩文件名 & " " & 中间文件名 Shell FileString, vbHide DeleteFile 中间文件名 '删除中间文件名