用VB访问RAR或者ZIP包中的数据,如何做到
注:分只给解决问题的人
注:分只给解决问题的人
解决方案 »
- 用VBA For循环找出重名点数据巨慢
- 如何利用API得到POS打印机返回信息
- 我想让打开的文档的字可以从左向右慢慢一行一行的打开到我的RichTextBox1上,直到这个文档所有行都显示完
- 给Image控件加动画图标能行吗?
- 数组做函数的输入参数是怎么定义的?
- 简单问题,看者有分:怎么在form窗体上打印输出????
- 如何在datagrid或msflexgrid的一列中显示图片啊?
- 如何用vbscript获取浏览器页面关闭事件
- 请求帮助
- 斑竹,斑竹(怎样利用API扑捉活动窗体以外的鼠标状态)
- 我用beep函数发一定频率的声音,但确是pc喇叭响,我想音箱响,如何办?
- 为什么在vb里运行出错会,而编译出来以后就不会?
zip的话有一些dll可以下载,我个人觉得aunzip.dll好一些,这里有用法和下载:http://foxpro.diy.myrice.com/article/wjys.htm
szArcName As Long ' INPUT: Should point to a zero terminated string containing the archive name
OpenMode As Long ' INPUT: RAR_OM_LIST - Open archive for reading file headers only
' RAR_OM_EXTRACT - Open archive for testing and extracting files
OpenResult As Long ' OUTPUT: 0 - Success
' ERAR_NO_MEMORY - Not enough memory to initialize data structures
' ERAR_BAD_DATA - Archive header broken
' ERAR_BAD_ARCHIVE - File is not a valid RAR archive
' ERAR_EOPEN - File open error
szCmtBuf As Long ' INPUT: Should point to a buffer for archive comments.
' Maximum comment size is limited to 64 KB. Comment text is zero termintad.
' If the comment text is larger than the buffer size, the comment text
' will be trunctated. If szCmtBuf is set to NULL, comments will not be read.
CmtBufSize As Long ' INPUT: Should contain size of buffer for archive comments
CmtSize As Long ' OUTPUT: Containing size of comments actually read into the buffer.
' Cannot exceed CmtBufSize.
CmtState As Long ' State:
' 0 - absent comments
' 1 - Comments read completely
' ERAR_NO_MEMORY - Not enough memory to extract comment
' ERAR_BAD_DATA - Broken comment
' ERAR_UNKNOWN_FORMAT - Unknown comment format
' ERAR_SMALL_BUF - Buffer too small, comments not completely read
End TypePublic Type RARHEADERDATA
Arcname As String * MAX_PATH ' Contains the zero terminated string of the current archive name.
' Maybe used to determine the current volume name
FileName As String * MAX_PATH ' Contains the zero terminated string of the file name
Flags As Long ' Flags
' bits 7 6 5 4 3 2 1 0
' 0 0 0 0 0 0 0 1 &H1& - file continued from previous volume
' 0 0 0 0 0 0 1 0 &H2& - file continues on next volume
' 0 0 0 0 0 1 0 0 &H4& - file encrypted with password
' 0 0 0 0 1 0 0 0 &H8& - file comment present
' 0 0 0 1 0 0 0 0 &H10& - compression of previous files is used
' (solid flag)
' 0 0 0 0 0 0 0 0 &H00& - dictionary size 64 KB
' 0 0 1 0 0 0 0 0 &H20& - dictionary size 128 KB
' 0 1 0 0 0 0 0 0 &H40& - dictionary size 256 KB
' 0 1 1 0 0 0 0 0 &H60& - dictionary size 512 KB
' 1 0 0 0 0 0 0 0 &H80& - dictionary size 1024 KB
' 1 0 1 0 0 0 0 0 &HA0& - reserved
' 1 1 0 0 0 0 0 0 &HC0& - reserved
' 1 1 1 0 0 0 0 0 &HE0& - file is directory
UnpSize As Long ' UnPacked file size
HostOS As Long ' Operating system used for archiving
' 0 - MS DOS
' 1 - OS/2
' 2 - Win32
' 3 - Unix
FileCRC As Long ' unpacked CRC of file. '
' It should not be used for file parts which were split between volumes.
'was FILETIME As Long ' Date & Time in standardMS-DOS format
FileTime As Integer
FileDate As Integer
' First 16 bits contain date
' Bits 0 - 4 : day (1-31)
' Bits 5 - 8 : month (1=January,12=December)
' Bits 9 - 15 : year (0=1980)
' Second 16 bits contain time
' Bits 0 - 4 : number of seconds divided by two
' Bits 5 - 10 : number of minutes (0-59)
' Bits 11 - 15: numer of hours (0-23)
UnpVer As Long ' RAR version required to extract the file
' It is encoded as 10 * Major version + minor version
Method As Long ' Packing method
FileAttr As Long ' File attributes
CmtBuf As Long ' INPUT: Should point to a buffer for file comments.
' Maximum comment size is limited to 64 KB. Comment text is zero termintad.
' If the comment text is larger than the buffer size, the comment text
' will be trunctated. If szCmtBuf is set to NULL, comments will not be read.
CmtBufSize As Long ' INPUT: Should contain size of buffer for file comments
CmtSize As Long ' OUTPUT: Containing size of comments actually read into the buffer.
' Should not exceed CmtBufSize.
CmtState As Long ' State:
' 0 - absent comments
' 1 - Comments read completely
' ERAR_NO_MEMORY - Not enough memory to extract comment
' ERAR_BAD_DATA - Broken comment
' ERAR_UNKNOWN_FORMAT - Unknown comment format
' ERAR_SMALL_BUF - Buffer too small, comments not completely read
End Type' Error constants
'Private Const ERAR_END_ARCHIVE = 10& ' end of archive
'Private Const ERAR_NO_MEMORY = 11& ' not enough memory to initialize data structures
'Private Const ERAR_BAD_DATA = 12& ' Archive header broken
'Private Const ERAR_BAD_ARCHIVE = 13& ' File is not valid RAR archive
'Private Const ERAR_UNKNOWN_FORMAT = 14& ' Unknown comment format
'Private Const ERAR_EOPEN = 15& ' File open error
'Private Const ERAR_ECREATE = 16& ' File create error
'Private Const ERAR_ECLOSE = 17& ' file close error
Private Const ERAR_EREAD = 18& ' Read error
Private Const ERAR_EWRITE = 19& ' Write error
' Private Const ERAR_SMALL_BUF = 20& ' Buffer too small, comment weren't read completely' OpenMode values
Public Const RAR_OM_LIST = 0& ' Open archive for reading file headers only
Private Const RAR_OM_EXTRACT = 1 ' Open archive for testing and extracting files' Operation values
Public Const RAR_SKIP = 0& ' Move to the next file in archive
' Warning: If the archive is solid and
' RAR_OM_EXTRACT mode was set when the archive
' was opened, the current file will be processed and
' the operation will be performed slower than a simple seek
'Private Const RAR_TEST = 1& ' Test the current file and move to the next file in
' the archive. If the archive was opened with the
' RAR_OM_LIST mode, the operation is equal to RAR_SKIP
Private Const RAR_EXTRACT = 2& ' Extract the current file and move to the next file.
' If the archive was opened with the RAR_OM_LIST mode,
' the operation is equal to RAR_SKIP' ChangeVolProc-Mode-parameter-values
'Private Const RAR_VOL_ASK = 0& ' Required volume is absent. The function should
' prompt the user and return non-zero value to retry the
' operation. The function may also specify a new
' volume name, placing it to ArcName parameter
'Private Const RAR_VOL_NOTIFY = 1& ' Required volume is successfully opened. This is a
' notification call and ArcName modification is NOT
' allowed. The function should return non-zero value
' to continue or a zero value to terminate operation' Open RAR archive and allocate memory structures (about 1MB)
' parameters: ArchiveData - points to RAROpenArchiveData structure
' returns: Archive handle or NULL in case of error