Friday, November 28, 2014
 
    Search Web Link
Search Software
    
API Home » Compress » LZCopy

LZCopy

Category: Compress
Hits: 5024 Rating: LZCopy has been rated 3.05 by  1068 users (3.05) votes 1068
Rate: 1-star  2-stars  3-stars  4-stars  5-stars
E-mail this API to friend E-mail this Code to a friend  save Bookmark this VB API Function
API Explanation
The 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.

Parameter Information
Declare Function LZCopy Lib "lz32.dll" Alias "LZCopy" (ByVal hfSource As Long, ByVal hfDest As Long) As Long

hfSource
Identifies the source file.

hfDest
Identifies the destination file.

If the function succeeds, the return value specifies the size, in bytes, of the destination file.
Code



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





HOME | MUSIC | DOWNLOADS |  GAMES | TEST-QUIZZES | SITEMAP | ABOUT | HELP
Copyright © 2000 - 2013 Ex-designz. All rights reserved. Website Developed By Dexter Zafra of Myasp-net.com
Link to us | Advertisement | Contact us | Privacy Policy | Terms of use | Accessibility