|
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName As String * 128
End Type
Private Declare Function LZOpenFile Lib "lz32.dll" Alias "LZOpenFileA" (ByVal lpszFile As String, lpOf As OFSTRUCT, ByVal style As Long) As Long
Private Declare Function LZCopy Lib "lz32.dll" (ByVal hfSource As Long, ByVal hfDest As Long) As Long
Private Declare Sub LZClose Lib "lz32.dll" (ByVal hfFile As Long)
Const OF_READ = &H0
Const OF_CREATE = &H1000
Const LZERROR_BADINHANDLE = (-1)
Const LZERROR_BADOUTHANDLE = (-2)
Const LZERROR_BADVALUE = (-7)
Const LZERROR_GLOBLOCK = (-6)
Const LZERROR_PUBLICLOC = (-5)
Const LZERROR_READ = (-3)
Const LZERROR_UNKNOWNALG = (-8)
Const LZERROR_WRITE = (-4)
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim SourceStruct As OFSTRUCT, DestStruct As OFSTRUCT
Dim hSource As Long, hDest As Long, lResults As Long
'Open the source- and the destination-files
hSource = LZOpenFile("c:\myfile.tx_", SourceStruct, OF_READ)
hDest = LZOpenFile("c:\myfile.tx", DestStruct, OF_CREATE)
'Copy the files
lResults = LZCopy(hSource, hDest)
'Close the files
LZClose hSource
LZClose hDest
'Check for errors
Select Case lResults
Case LZERROR_BADINHANDLE
MsgBox "LZERROR_BADINHANDLE"
Case LZERROR_BADOUTHANDLE
MsgBox "LZERROR_BADOUTHANDLE"
Case LZERROR_BADVALUE
MsgBox "LZERROR_BADVALUE"
Case LZERROR_GLOBLOCK
MsgBox "LZERROR_GLOBLOCK"
Case LZERROR_PUBLICLOC
MsgBox "LZERROR_PUBLICLOC"
Case LZERROR_READ
MsgBox "LZERROR_READ"
Case LZERROR_UNKNOWNALG
MsgBox "LZERROR_UNKNOWNALG"
Case LZERROR_WRITE
MsgBox "LZERROR_WRITE"
End Select
End Sub
|
|