当前位置:编程学习 > C#/ASP.NET >>

利用WinRar压缩与解压VB.NET

要有进度条的 有这反面的类吗?有的话那位大哥给一个吧? --------------------编程问答-------------------- Public Function UnRAR(ByVal path As String, ByVal rarPath As String, ByVal rarName As String) As Boolean
  Dim flag As Boolean = False
  Dim rarexe As String
  Dim regkey As RegistryKey
  Dim regvalue As [Object]
  Dim cmd As String
  Dim startinfo As ProcessStartInfo
  Dim process As Process
  Try
  regkey = Registry.ClassesRoot.OpenSubKey("Applications\WinRAR.exe\shell\open\command")
  regvalue = regkey.GetValue("")
  rarexe = regvalue.ToString()
  regkey.Close()
  rarexe = rarexe.Substring(1, rarexe.Length - 7)
    
  Directory.CreateDirectory(path)
  cmd = String.Format("x {0} {1} -y", rarName, path)
  startinfo = New ProcessStartInfo()
  startinfo.FileName = rarexe
  startinfo.Arguments = cmd
  startinfo.WindowStyle = ProcessWindowStyle.Hidden
    
  startinfo.WorkingDirectory = rarPath
  process = New Process()
  process.StartInfo = startinfo
  process.Start()
  process.WaitForExit()
  If process.HasExited Then
  flag = True
  End If
  process.Close()
  Catch e As Exception
  Throw e
  End Try
  Return flag
End Function  --------------------编程问答-------------------- 能加几句注视吗 有些真不大看得懂

--------------------编程问答-------------------- 读取注册表的winrar的exe路径。
格式化运行rar的运行命令参数
用进程启动winrar解压 
你也许要去看winrar的命令参数。winrar里面有一个帮助文件。你看看就知道了。
--------------------编程问答-------------------- 很有意义~~ --------------------编程问答-------------------- 好像解压的时候 不行
        UnRAR(Application.StartupPath & RARpath, Application.StartupPath & StoragePath, "123")
这样调用不解压 
我把rar文件放在C盘就可以解压 是怎么回事 --------------------编程问答-------------------- 权限问题吧 --------------------编程问答-------------------- --------------------编程问答-------------------- 有没有封装完整的类库啊  比如 unrar.dll 的 
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,