dポイントプレゼントキャンペーン実施中!

VB.NETでフォルダ(ファイル)を圧縮するプログラムを作っています。
http://homepage1.nifty.com/rucio/main/Samples/Sa …
このページのやり方が一番簡単だと思ったのですが、
VB6のコードなので使えません。
どうすればVB.NETで使えるでしょうか。

A 回答 (1件)

Option Explicit On


Option Strict On
Option Compare Binary
Option Infer Off

'とりあえず自分のところでは動作している。
'StrBufferを空文字列にして良いのか自信ない。

Class Q4206113
Private Declare Function Unlha Lib "Unlha32.dll" (ByVal hWnd As Integer, ByVal szCmdLine As String, ByVal szOutput As String, ByVal dwSize As Integer) As Integer

Shared Sub Main()
Call LhaPress("C:\newa.pl.txt","C:\hoge.lzh",Nothing)
End Sub

Shared Sub LhaPress(SourceFileName As String, TargetFileName As String, hWnd As Integer)

Dim strSwitch As String
Dim strOptions As String
Dim strCommandLine As String
Dim StrBuffer As String

strSwitch = "a"
strOptions = "-x1 -r2"
strCommandLine = strSwitch & " " & strOptions & " """ & TargetFileName & """ """ & SourceFileName & """"
        StrBuffer = ""

Call Unlha(hWnd, strCommandLine, strBuffer, 1024)

End Sub

End Class
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!