Функция LZOpenFileКод | 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()
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
| Добавлено @ 15:32 Функция LZCloseКод | 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()
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
| Добавлено @ 15:33 Функция LZCopyОписание : Функция LZCopy function copies a source file to a destination file. If the source file is compressed with the Microsoft File Compression Utility (COMPRESS.EXE), this function creates a decompressed destination file.Код | 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()
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
| Добавлено @ 15:34 взято с сайта http://www.vb.kiev.ua/ Добавлено @ 15:46 вот ещё ссылочка может интерестно будет http://www.zlib.net/
--------------------
Я родился в этом безумном мире - и Я сделаю всё чтобы в нём выжить!
|