home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / SOFTWARE / LIBS / VBLZH.ZIP / VBLZH.BAS (.txt) < prev    next >
BASIC Source File  |  1995-07-30  |  8KB  |  191 lines

  1. 'VBLZH.DLL by Philip Bush - Copyright 1995
  2. '
  3. ' Compression/Decompression, file functions, and disk space functions for Visual Basic
  4. '
  5. ' SHAREWARE FEE $15
  6. '
  7. ' Benefits:  - Unlimited distribution rights for registered users.
  8. '            - Receive the latest registered version by floppy disk.
  9. '            - Removes shareware notice from compression/decompression status window.
  10. '
  11. ' Borland Delphi (pascal) VBLZH.DLL source code $99.
  12. '
  13. ' Philip Bush
  14. ' Macware
  15. ' 748 N. Hwy 67, Suite 163
  16. ' Florissant, MO  63031
  17. '
  18. ' check/money order/cash/Visa/Mastercard payments accepted
  19. '
  20. ' phone: (314) 838-7620    email: WWHH86A@PRODIGY.COM
  21.  
  22. '**PROCEDURE/FUNCTION SUMMARY**
  23.  
  24. '  LZH                lzh compression & decompression of files, includes status Window
  25. '  DelFile%           deletes file from a disk
  26. '  RenFile%           renames a file
  27. '  GetFileSize&       file size in bytes
  28. '  FileExist%         does file exist
  29. '  CopyFile%          copies a file
  30. '  RetrieveFileName$  retrieves the file name from fully or partially qualified path name
  31. '  RetrieveFilePath$  retrieves the file path from fully or partially qualified path name
  32. '  FileDate&          date of the file named by FName as a LongInt (use CVDATE to evaluate)
  33. '  FileExtension$     returns a string containing the three-character extension
  34. '  FSearch$           searches through directories for a particular file name
  35. '  FAttribDescr$      returns a file attribute description (/ delimited text description)
  36. '  FAttribVal%        returns file attribute value
  37. '  FileSetAttrib%     set a file's attributes
  38. '  DiskFreeSpace&     returns a disk's free space in bytes
  39. '  DiskSpace&         returns disk size in bytes
  40.  
  41. '**DECLARE**
  42.  
  43. Declare Sub LZH Lib "VBLZH.DLL" (ByVal fromfile$, ByVal tofile$, ByVal action$, errc&, inf&, otf&)
  44. Declare Function DelFile% Lib "VBLZH.DLL" (ByVal FName$)
  45. Declare Function RenFile% Lib "VBLZH.DLL" (ByVal OldF$, ByVal NewF$)
  46. Declare Function GetFileSize& Lib "VBLZH.DLL" (ByVal FName$)
  47. Declare Function FileExist% Lib "VBLZH.DLL" (ByVal FName$)
  48. Declare Function CopyFile% Lib "VBLZH.DLL" (ByVal FromF$, ByVal ToF$)
  49. Declare Function RetrieveFileName$ Lib "VBLZH.DLL" (ByVal FName$)
  50. Declare Function RetrieveFilePath$ Lib "VBLZH.DLL" (ByVal FName$)
  51. Declare Function FileDate& Lib "VBLZH.DLL" (ByVal FName$)
  52. Declare Function FileExtension$ Lib "VBLZH.DLL" (ByVal FName$)
  53. Declare Function FSearch$ Lib "VBLZH.DLL" (ByVal FName$, ByVal DirList$)
  54. Declare Function FAttribVal% Lib "VBLZH.DLL" (ByVal FName$)
  55. Declare Function FAttribDescr$ Lib "VBLZH.DLL" (ByVal FName$)
  56. Declare Function FileSetAttrib% Lib "VBLZH.DLL" (ByVal FName$, ByVal attr%)
  57. Declare Function DiskFreeSpace& Lib "VBLZH.DLL" (ByVal driveltr$)
  58. Declare Function DiskSpace& Lib "VBLZH.DLL" (ByVal driveltr$)
  59.  
  60. '**INSTRUCTIONS**
  61.  
  62. '*LZH file compression & decompression
  63. ' usage:
  64. '  fromfile$ = original file
  65. '  tofile$   = destination file (caution, will be overwritten!)
  66. '  action$   = "E" = compresss (encode)  "D" = uncompress (decode)
  67. '
  68. ' returns:
  69. '  errc& (error codes):
  70. '   errc& = -1   no error encountered
  71. '   errc& =  1   Error reading input file
  72. '   errc& =  2   Error writing output file
  73. '   errc& =  3   Error opening input
  74. '   errc& =  4   Error opening output
  75. '   errc& =  5   Error: use [D] for Decompression or [E] for Compression
  76. '   errc& =  6   overflow read error - usually during decode on a non-compressed file
  77. '   errc& =  7   overflow write error - usually during decode on a non-compressed file
  78. '   errc& =  8   Error getting filesize
  79. '
  80. '  inf& = original file size in bytes
  81. '  otf& = destination file size in bytes
  82. '
  83. 'Declare Sub LZH Lib "VBLZH.DLL" (ByVal fromfile$, ByVal tofile$, ByVal action$, errc&, inf&, otf&)
  84.  
  85. '*Delete File
  86. ' -1 = successful, 0 = failed (file cannot be deleted or does not exist)
  87. '
  88. 'Declare Function DelFile% Lib "VBLZH.DLL" (ByVal Fname$)
  89.  
  90. '*RenFile function attempts to change the name of the file specified by Old to New
  91. ' -1 = successful, false = failed (will not rename if new already exists)
  92. '
  93. 'Declare Function RenFile% Lib "VBLZH.DLL" (ByVal OldF$,ByVal NewF$)
  94.  
  95. '*GetFileSize function returns the file size in bytes
  96. 'HFILE_ERROR or -1 = failed, >= 0 file size in bytes
  97. '
  98. 'Declare Function GetFileSize& Lib "VBLZH.DLL" (ByVal Fname$)
  99.  
  100. '*FileExist function tests if a file exists
  101. ' -1 = file exists, 0 = file doesn't exist
  102. '
  103. 'Declare Function FileExist% Lib "VBLZH.DLL" (ByVal Fname$)
  104.  
  105. '*CopyFile function copies the FromFile to the ToFile
  106. ' -1 = successful, 0 = file copy failed
  107. '
  108. 'Declare Function CopyFile% Lib "VBLZH.DLL" (ByVal FromF$, ByVal ToF$)
  109.  
  110. '*RetrieveFileName takes a fully or partially qualified path name in FName and returns
  111. '  a string containing only the file name part, including the name and extension.
  112. '
  113. 'Declare Function RetrieveFileName$ Lib "VBLZH.DLL" (ByVal FName$)
  114.  
  115. '*RetrieveFilePath takes a fully or partially qualified path name in FName and returns
  116. '  a string containing only the path part (drive letter and directories).
  117. '
  118. 'Declare Function RetrieveFilePath$ Lib "VBLZH.DLL" (ByVal FName$)
  119.  
  120. '*FileDate function returns the date of the file named by FName as a LongInt.
  121. '  Use the VB function CVDATE to evaluate. Ex: Dt$=CVDATE(FileDate&("C:\AUTOEXEC.BAT"))
  122. '  -999999 = error. usually indicates that the file doesn't exist.
  123. '             (note: check for this value - CVDATE will return an error using this value)
  124. '
  125. 'Declare Function FileDate& Lib "VBLZH.DLL" (ByVal FName$)
  126.  
  127. '*FileExtension function takes a fully qualified FileName and returns a string
  128. '  containing the three-character extension.
  129. '
  130. 'Declare Function FileExtension$ Lib "VBLZH.DLL" (ByVal FName$)
  131.  
  132. '*FSearch function searches through the directories passed in DirList for a file named
  133. '  Name. DirList should be in the same format as a DOS PATH: directory names
  134. '  separated by semicolons. If FileSearch locates a file matching Name, it returns a string
  135. '  containing a fully-qualified path name for that file. If no matching file exists,
  136. '  FileSearch returns an empty string.
  137. '
  138. 'Declare Function FSearch$ Lib "VBLZH.DLL" (ByVal FName$, Byval DirList$)
  139.  
  140. '*FAttribVal returns the file attributes of the file given by FName.  The attributes can
  141. '  be examined by AND-ing with the constants listed below. If the return value is negative,
  142. '  an  error occurred and the value is a negative DOS error code.
  143. '    Normal            0
  144. '    Read-only files   1
  145. '    Hidden files      2
  146. '    System files      4
  147. '    Volume ID files   8
  148. '    Directory files  16
  149. '    Archive files    32
  150. '    Unusual          63
  151. '
  152. ' <0 = error
  153. '
  154. 'Declare Function FAttribVal% Lib "VBLZH.DLL" (ByVal FName$)
  155.  
  156. '*FAttribDescr returns the file attributes of the file given by FName.  The attributes are
  157. '  in a slash (\) delimited string.
  158. '  Returns may include: Normal,Read-only,Hidden,System,Volume, Directory, Archive, Unusual
  159. '                       and Error
  160. '
  161. 'Declare Function FAttribDescr$ Lib "VBLZH.DLL" (ByVal FName$)
  162.  
  163. '*FileSetAttrib sets the file attributes of the file given by FileName to the value given
  164. '  by Attr. The attribute value is formed by OR-ing the appropriate constants (listed below).
  165. '  The return value is zero if the function was successful. Otherwise the return value is a
  166. '   negative DOS error code.
  167. '    Normal            0
  168. '    Read-only files   1
  169. '    Hidden files      2
  170. '    System files      4
  171. '    Volume ID files   8
  172. '    Directory files  16
  173. '    Archive files    32
  174. '    Unusual          63
  175. '
  176. ' <0 = error
  177. '
  178. 'Declare Function FileSetAttrib% Lib "VBLZH.DLL" (ByVal FName$, ByVal attr%)
  179.  
  180.  
  181. 'Disk Free Space returns the free space in bytes of the specified drive
  182. ' -1 = drive letter is invalid, >=0 = disk free space in bytes
  183. '
  184. 'Declare Function DiskFreeSpace& Lib "VBLZH.DLL" (ByVal driveltr$)
  185.  
  186. '*DiskSpace returns the size in bytes of the specified drive
  187. ' -1 = drive letter is invalid, >=0 = disk size in bytes
  188. '
  189. 'Declare Function DiskSpace& Lib "VBLZH.DLL" (ByVal driveltr$)
  190.  
  191.