純VB VBA代碼寫(xiě)的zip壓縮和解壓縮類(lèi)模塊
- 2017-09-12 08:40:00
- 國(guó)外 轉(zhuǎn)貼
- 4475
純VB代碼寫(xiě)的zip壓縮和解壓縮類(lèi)模塊 Option Explicit 'VB性能大討論: 頂級(jí)專傢用VB寫(xiě)的壓縮祘法居然比C++編寫(xiě)的WinRar壓縮祘法慢100倍, '該代碼是一位俄羅斯專傢寫(xiě)的,極具收藏價(jià)值和實(shí)用價(jià)值,隻可惜速度慢瞭一些. '現(xiàn)附源代碼供大傢學(xué)習(xí)和收藏,衕時(shí)也請(qǐng)各位高手對(duì)源代碼分析, 看看能不能進(jìn)行一些優(yōu)化. 請(qǐng)大傢把優(yōu)化後的測(cè)試結(jié)果貼齣來(lái)供其他人學(xué)習(xí)和討論. '測(cè)試程序: ' Dim ObjZip As New ClassZip ' ' ObjZip.InputFileName = "C:\1\Test.Bmp" ' ObjZip.InputFileName = "C:\1\Test.Zip" ' ObjZip.Compress ' ' .... ' '===================================== '下麵是 ClassZip的全部源代碼 '====================================== Public Event FileProgress(sngPercentage As Single) Private m_strInputFileName As String Private m_strOutputFileName As String Private mintInputFile As Integer Private mintOutputFile As Integer Private Const mcintWindowSize As Integer = &H1000 Private Const mcintMaxMatchLen As Integer = 18 Private Const mcintMinMatchLen As Integer = 3 Private Const mcintNull As Integer = &H1000 Private Const mcintByteNotify As Integer = &H1000 Private mabytWindow(mcintWindowSize + mcintMaxMatchLen) As Byte Private maintWindowNext(mcintWindowSize + 1 + mcintWindowSize) As Integer Private maintWindowPrev(mcintWindowSize + 1) As Integer Private mintMatchPos As Integer Private mintMatchLen As Integer ' ******************************************* ' This is for writing the bytes out to a file ' ******************************************* Private mabytOutputBuffer(17) As Byte Private mbytByteCodeWritten As Byte Private mbytBitCount As Byte ' LZ signature Private Const mcstrSignature As String = "FMSLZ1" Public Property Get InputFileName() As String ' Returns the input file name InputFileName = m_strInputFileName End Property Public Property Let InputFileName(ByVal strValue As String) 'strValue: Set the input file name m_strInputFileName = strValue End Property Public Property Get OutputFileName() As String 'Returns the output file name OutputFileName = m_strOutputFileName End Property Public Property Let OutputFileName(ByVal strValue As String) 'strValue: Set the output file name m_strOutputFileName = strValue End Property Public Sub Compress() '*********************************************************** 'This procedure compresses the input file to the output file '*********************************************************** Dim intBufferLocation As Integer Dim intMaxLen As Integer Dim bytByte As Byte Dim lngBytesRead As Long Dim lngFileLength As Long On Error GoTo PROC_ERR ' Get the next free file id mintInputFile = FreeFile 'Openz the input file Open m_strInputFileName For Binary Access Read As mintInputFile 'Try to delete the output file. If it doesn't exist an error is raised On Error Resume Next Kill m_strOutputFileName On Error GoTo PROC_ERR ' Get the next free file id mintOutputFile = FreeFile ' Open the output file Open m_strOutputFileName For Binary As mintOutputFile ' Initialize the search buffers CompressionInitialize intBufferLocation = 0 intMaxLen = 0 lngFileLength = LOF(mintInputFile) ' write header Put mintOutputFile, , mcstrSignature Put mintOutputFile, , lngFileLength ' Prefill the end of the buffer with the first characters in the file Do While (intMaxLen < mcintMaxMatchLen) And Not EOF(mintInputFile) Get mintInputFile, , bytByte mabytWindow(intMaxLen) = bytByte mabytWindow(intMaxLen + mcintWindowSize) = mabytWindow(intMaxLen) intMaxLen = intMaxLen + 1 lngBytesRead = lngBytesRead + 1 Loop ' While there is a match in the buffer Do While (intMaxLen) ' Find the next match FindMatch (intBufferLocation) If (mintMatchLen > intMaxLen) Then mintMatchLen = intMaxLen End If ' -> If the match is less than the minimum length, just write out the byte If (mintMatchLen < mcintMinMatchLen) Then mintMatchLen = 1 WriteByte mabytWindow(intBufferLocation) Else WriteEntry mintMatchPos, mintMatchLen End If ' Update the window for each character in the match Do While (mintMatchLen > 0) ' Remove the current position from the search tables DeletePosition ((intBufferLocation + mcintMaxMatchLen) And (mcintWindowSize - 1)) intMaxLen = intMaxLen - 1 If Not EOF(mintInputFile) Then Get mintInputFile, , bytByte ' Update the window mabytWindow((intBufferLocation + mcintMaxMatchLen) And (mcintWindowSize - 1)) = bytByte ' Special handling for updating the end of the buffer If (intBufferLocation + mcintMaxMatchLen >= mcintWindowSize) Then mabytWindow(intBufferLocation + mcintMaxMatchLen) = bytByte End If lngBytesRead = lngBytesRead + 1 intMaxLen = intMaxLen + 1 End If ' Update the search tables InsertPosition (intBufferLocation) intBufferLocation = (intBufferLocation + 1) And (mcintWindowSize - 1) mintMatchLen = mintMatchLen - 1 ' Raise the progress event If (lngBytesRead Mod mcintByteNotify) = 0 Then RaiseEvent FileProgress(lngBytesRead / lngFileLength) End If Loop ' Raise the progress event If (lngBytesRead Mod mcintByteNotify) = 0 Then RaiseEvent FileProgress(lngBytesRead / lngFileLength) End If Loop ' Finish writing the output file WriteFinish RaiseEvent FileProgress(1) ' Close the files we opened Close mintOutputFile Close mintInputFile U_ext: Exit Sub ' if error show message box PROC_ERR: MsgBox "Error: Compress", vbCritical, "ULZ" Resume U_ext End Sub Public Sub Decompress() '************************************************************* 'This procedure decompresses the input file to the output file '************************************************************* Dim intCounter As Integer Dim bytHiByte As Byte Dim intBufferLocation As Integer Dim bytLoByte As Byte Dim bytLength As Byte Dim intWindowPosition As Integer Dim bytByte As Byte Dim intFlags As Integer Dim lngBytesRead As Long Dim lngBytesWritten As Long Dim strSignature As String * 6 Dim lngOriginalFileLen As Long On Error GoTo PROC_ERR ' Get the next free file id mintInputFile = FreeFile ' Open the input file Open m_strInputFileName For Binary Access Read As mintInputFile ' Try to delete the output file. If it doesn't exist an error is raised On Error Resume Next Kill m_strOutputFileName On Error GoTo PROC_ERR ' Get the next free file id mintOutputFile = FreeFile ' Open the output file Open m_strOutputFileName For Binary As mintOutputFile ' get header Get mintInputFile, , strSignature Get mintInputFile, , lngOriginalFileLen ' Check the signature to see if this file is compressed If strSignature = mcstrSignature Then ' While there is still data to decompress Do While lngBytesWritten < lngOriginalFileLen intFlags = Shri(intFlags, 1) ' If the flag byte has been processed, get the next one If (intFlags And 256) = 0 Then Get mintInputFile, , bytByte lngBytesRead = lngBytesRead + 1 intFlags = LongToInt(CLng(bytByte) Or &HFF00&) End If ' If this byte is not compressed If (intFlags And 1) Then ' Read from the input and write to the output Get mintInputFile, , bytByte lngBytesRead = lngBytesRead + 1 Put mintOutputFile, , bytByte lngBytesWritten = lngBytesWritten + 1 ' Update the window mabytWindow(intWindowPosition) = bytByte intWindowPosition = intWindowPosition + 1 intWindowPosition = intWindowPosition And (mcintWindowSize - 1) Else ' This byte is compressed ' Get the window position and length of the match Get mintInputFile, , bytHiByte lngBytesRead = lngBytesRead + 1 Get mintInputFile, , bytLoByte lngBytesRead = lngBytesRead + 1 intBufferLocation = BufPosition(bytHiByte, bytLoByte) bytLength = BufLength(bytLoByte) intCounter = 0 ' Read the data from the window and write to the output Do While intCounter < bytLength bytByte = mabytWindow((intBufferLocation + intCounter) And (mcintWindowSize - 1)) Put mintOutputFile, , bytByte lngBytesWritten = lngBytesWritten + 1 mabytWindow(intWindowPosition) = bytByte intWindowPosition = intWindowPosition + 1 intWindowPosition = intWindowPosition And (mcintWindowSize - 1) intCounter = intCounter + 1 ' Raise the progress event If (lngBytesWritten Mod mcintByteNotify) = 0 Then RaiseEvent FileProgress(lngBytesWritten / lngOriginalFileLen) End If Loop End If ' Raise the progress event If (lngBytesWritten Mod mcintByteNotify) = 0 Then RaiseEvent FileProgress(lngBytesWritten / lngOriginalFileLen) End If Loop RaiseEvent FileProgress(1) End If ' Close the files we opened Close mintOutputFile Close mintInputFile U_ext: Exit Sub PROC_ERR: MsgBox "Error: Decompress", vbCritical, "ULZ" Resume U_ext End Sub Private Sub BitSetByte(bytNumber As Byte, bytBitNumber As Byte) '********************************************* ' This procedure sets a bit in a byte variable '********************************************* ' Parameterz: 'bytNumber - The byte variable to set the bit in. The result is also returned ' in this parameter 'bytBitNumber - The bit number to clear On Error GoTo PROC_ERR bytNumber = bytNumber Or Shlb(1, bytBitNumber) U_ext: Exit Sub PROC_ERR: MsgBox "Error: Bit Set Byte", vbCritical, "ULZ" Resume U_ext End Sub Private Function BufLength(bytLoByte As Byte) As Byte '******************************************** 'This function returns the length of an entry '******************************************** ' Parameterz ' bytLoByte - The low byte of the entry ' Returnz the length of the entry On Error GoTo PROC_ERR BufLength = (bytLoByte And &HF) + mcintMinMatchLen U_ext: Exit Function PROC_ERR: MsgBox "Error: Buffeer Leghth", , vbCritical, "ULZ" Resume U_ext End Function Private Function BufPosition(bytHiByte As Byte, bytLoByte As Byte) As Integer '****************************************************** ' This function returns the window position of an entry '****************************************************** ' bytHiByte - The high byte of the entry ' bytLoByte - The low byte of the entry ' Returnz : The position of the entry Dim intPosition As Integer ' if error then show message On Error GoTo PROC_ERR intPosition = Shli(bytLoByte And &HF0, 4) + bytHiByte intPosition = intPosition And &HFFF BufPosition = intPosition U_ext: ' exit Exit Function PROC_ERR: ' error message MsgBox "Error: Buffer Position", vbCritical, "ULZ" Resume U_ext End Function Private Sub CompressionInitialize() ' ************************************************************************** ' This procedure initializes the module variables for the compression and ' decompression routines ' ************************************************************************** Dim intCounter As Integer On Error GoTo PROC_ERR ' Initialize the window to spaces For intCounter = 0 To mcintWindowSize + mcintMaxMatchLen - 1 mabytWindow(intCounter) = Asc(" ") Next intCounter For intCounter = 0 To mcintWindowSize + mcintWindowSize maintWindowNext(intCounter) = mcintNull Next intCounter For intCounter = 0 To mcintWindowSize maintWindowPrev(intCounter) = mcintNull Next intCounter 'Reset write buffer mabytOutputBuffer(0) = 0 mbytByteCodeWritten = 1 mbytBitCount = 0 U_ext: ' exit Exit Sub PROC_ERR: ' error message MsgBox "Error: Initialize", vbCritical, "ULZ" Resume U_ext End Sub Private Function dblToLong(ByVal dblNumber As Double) As Long ' ***************************************************************************** ' This routine does an unsigned conversion from a double Value to a long Value. ' This procedure correctly handles any double value ' ***************************************************************************** 'Parameterz ' dblNumber - the double value to convert to a long ' long returnz Dim dblDivisor As Double Dim dblTemp As Double On Error GoTo PROC_ERR ' Visual basic does not allow you enter the value &H100000000 directly, ' so we enter &H7FFFFFFF, double it and add two to create it. dblDivisor = &H7FFFFFFF dblDivisor = (dblDivisor * 2) + 2 'if the number is larger than a long can store, then truncate it If dblNumber > dblDivisor Or dblNumber < 0 Then dblTemp = dblNumber - (Int(dblNumber / dblDivisor) * dblDivisor) Else dblTemp = dblNumber End If ' if the number is greater than a signed long, convert it to a negative If dblTemp > &H7FFFFFFF Then dblToLong = dblTemp - dblDivisor ElseIf dblTemp < 0 Then ' If the number is negative dblToLong = dblDivisor + dblTemp Else dblToLong = dblTemp End If U_ext: 'exit Exit Function PROC_ERR: MsgBox "Error: dbltoLong", vbExclamation, "ULZ" Resume U_ext End Function Private Sub DeletePosition(intCurBufIndex As Integer) ' ************************************************** ' This procedure removes a character from the window ' ************************************************** ' Parameterz: ' intCurBufIndex - The index of the byte in the window to delete Dim intNext As Integer Dim intPrev As Integer On Error GoTo PROC_ERR ' If this position has been previously assigned If (maintWindowPrev(intCurBufIndex) <> mcintNull) Then ' Update the next character array with the previous value intPrev = maintWindowPrev(intCurBufIndex) intNext = maintWindowNext(intCurBufIndex) maintWindowNext(intPrev) = intNext maintWindowPrev(intNext) = intPrev maintWindowNext(intCurBufIndex) = mcintNull maintWindowPrev(intCurBufIndex) = mcintNull End If U_ext: Exit Sub PROC_ERR: MsgBox "Error: DeletePosition", vbExclamation, "ULZ" Resume U_ext End Sub Private Sub FindMatch(intCurBufIndex As Integer) ' ************************************************* ' This procedure searches for a match in the window ' ************************************************* ' intCurBufIndex - The current position in the window Dim intPos As Integer Dim intKey As Integer Dim intCounter As Integer On Error GoTo PROC_ERR mintMatchPos = 0 mintMatchLen = mintMatchPos 'calculate position intKey = (mabytWindow(intCurBufIndex) + Shli(mabytWindow(intCurBufIndex + 1), 8) And &HFFF&) + mcintWindowSize + 1 ' If we have encountered this two letter combination before, intPos will hold ' the position at which we last last encountered it intPos = maintWindowNext(intKey) intCounter = 0 Do While (intPos <> mcintNull) And (intCounter <> mcintMaxMatchLen) 'Find a match in the window intCounter = 0 Do While intCounter < mcintMaxMatchLen And mabytWindow(intPos + intCounter) = mabytWindow(intCurBufIndex + intCounter) intCounter = intCounter + 1 Loop ' If this is the best match so far, keep track of it If (intCounter > mintMatchLen) Then mintMatchLen = intCounter mintMatchPos = (intPos) And (mcintWindowSize - 1) End If ' Retrieve the next index into the window intPos = maintWindowNext(intPos) Loop If (intCounter = mcintMaxMatchLen) Then DeletePosition (intPos) End If U_ext: Exit Sub PROC_ERR: MsgBox "Error: FindMatch", vbCritical, "ULZ" Resume U_ext End Sub Private Function HiByte(ByVal intNumber As Integer) As Byte ' ******************************************* ' Returns the high byte of the passed integer ' ******************************************* ' intNumber - integer to return the high byte of ' Return the byte On Error GoTo PROC_ERR HiByte = Int((IntToLong(intNumber) / &H100&)) And &HFF& U_ext: Exit Function PROC_ERR: MsgBox "Error: HiByte", vbCritical, "ULZ" Resume U_ext End Function Private Function HiWord(lngNumber As Long) As Integer ' ******************************************* ' Returns the high integer of the passed long ' ******************************************* ' lngNumber - long value to return the high integer of ' Return the integer On Error GoTo PROC_ERR HiWord = LongToInt(Int((lngNumber / &H10000))) U_ext: Exit Function PROC_ERR: MsgBox "Error: HiWord", vbCritical, "ULZ" Resume U_ext End Function Private Sub InsertPosition(intCurBufIndex As Integer) ' ************************************************** ' This procedure inserts a character into the window ' ************************************************** ' intCurBufIndex - The index of the byte in the window to insert ' What the function returns or 'Nothing' Dim intNextChar As Integer Dim intKey As Integer On Error GoTo PROC_ERR ' Calculate hash key based on the current byte and the next byte intKey = (mabytWindow(intCurBufIndex) + Shli(mabytWindow(intCurBufIndex + 1), 8) And &HFFF&) + mcintWindowSize + 1 'Get the last position pointed to by this key intNextChar = maintWindowNext(intKey) ' Set the position in the lookup buffer to the current position in the window maintWindowNext(intKey) = intCurBufIndex ' keep track of the last position pointed to by this key maintWindowPrev(intCurBufIndex) = intKey ' point the current position in the next window to the key position in the next ' buffer maintWindowNext(intCurBufIndex) = intNextChar ' If there was a previous character If (intNextChar <> mcintNull) Then maintWindowPrev(intNextChar) = intCurBufIndex End If U_ext: Exit Sub PROC_ERR: MsgBox "Error: InsertPosition", vbCritical, "ULZ" Resume U_ext End Sub Private Function IntToByte(ByVal intNumber As Integer) As Byte ' ************************************************************************ ' This routine does an unsigned conversion from an integer value to a byte ' value. This procedure correctly handles any integer value ' ************************************************************************ ' intNumber - the integer value to convert to a byte ' return the Byte On Error GoTo PROC_ERR IntToByte = intNumber And &HFF& U_ext: Exit Function PROC_ERR: MsgBox "Error: IntToByte", vbCritical, "ULZ" Resume U_ext End Function Private Function IntToLong(ByVal intNumber As Integer) As Long ' **************************************************************************** ' This routine converts an integer value to a long value, treating the integer ' as unsigned ' **************************************************************************** ' Parameters: intNumber - the integer to convert to long ' retiurn the long On Error GoTo PROC_ERR ' This routine converts an integer value to a long value If intNumber < 0 Then IntToLong = intNumber + &H10000 Else IntToLong = intNumber End If U_ext: Exit Function PROC_ERR: MsgBox "Error: IntToLong", vbCritical, "ULZ" Resume U_ext End Function Private Function LoByte(ByVal intNumber As Integer) As Byte ' ****************************************** ' Returns the low byte of the passed integer ' ****************************************** ' intNumber - integer to return the low byte of ' rEturn the byte On Error GoTo PROC_ERR LoByte = intNumber And &HFF& U_ext: Exit Function PROC_ERR: MsgBox "Error: LoByte" Resume U_ext End Function Private Function LongToInt(ByVal lngNumber As Long) As Integer ' ****************************************************************************** ' This routine does an unsigned conversion from a long value to an integer value. ' This procedure correctly handles any long value ' ****************************************************************************** ' lngNumber - the long value to convert to an integer ' returnz the Integer On Error GoTo PROC_ERR ' This routine converts a long value to an integer lngNumber = lngNumber And &HFFFF& If lngNumber > &H7FFF Then LongToInt = lngNumber - &H10000 Else LongToInt = lngNumber End If U_ext: Exit Function PROC_ERR: MsgBox "Error: LongToInt", vbCritical, "ULZ" Resume U_ext End Function Private Function LoWord(ByVal lngNumber As Long) As Integer ' ****************************************** ' Returns the low integer of the passed long ' ****************************************** ' lngNumber - long to return the low integer of ' Returnz the integer On Error GoTo PROC_ERR LoWord = LongToInt(lngNumber And &HFFFF&) U_ext: Exit Function PROC_ERR: MsgBox "Error: LoWord", vbCritical, "ULZ" Resume U_ext End Function Private Function Shlb(ByVal bytValue As Byte, ByVal bytPlaces As Byte) As Byte ' ******************************************************** ' Shifts a numeric value left the specified number of bits. ' ********************************************************* ' bytValue - byte value to shift ' bytPlaces - number of places to shift ' Returnz the Shifted value Dim lngMultiplier As Long On Error GoTo PROC_ERR ' if we are shifting 8 or more bits, then the result is always zero If bytPlaces >= 8 Then Shlb = 0 Else lngMultiplier = 2 ^ bytPlaces Shlb = IntToByte(LongToInt(bytValue * lngMultiplier)) End If U_ext: Exit Function PROC_ERR: MsgBox "Error: Shlb", vbCritical, "ULZ kewl" Resume U_ext End Function Private Function Shli(ByVal intValue As Integer, ByVal bytPlaces As Byte) As Integer ' ********************************************************************************** ' Shifts a numeric value left the specified number of bits. Left shifting can be ' defined as a multiplication operation. For the number of bits we want to shift a ' value to the left, we need to raise two to that power, then multiply the result by ' our original value. ' ********************************************************************************** ' intValue - integer value to shift ' bytPlaces - number of places to shift ' reeturn Shifted value Dim lngMultiplier As Long On Error GoTo PROC_ERR ' if we are shifting 16 or more bits, then the result is always zero If bytPlaces >= 16 Then Shli = 0 Else lngMultiplier = 2 ^ bytPlaces Shli = LongToInt(intValue * lngMultiplier) End If U_ext: Exit Function PROC_ERR: MsgBox "Error: Shli", vbCritical, "ULZ" Resume U_ext End Function Private Function Shll(ByVal lngNumber As Long, ByVal bytPlaces As Byte) As Long ' ********************************************************* ' Shifts a numeric Value left the specified number of bits. ' ********************************************************* ' lngNumber - long Value to shift ' bytPlaces - number of places to shift ' Returnz the Shifted Value Dim dblMultiplier As Double On Error GoTo PROC_ERR ' if we are shifting 32 or more bits, then the result is always zero If bytPlaces >= 32 Then Shll = 0 Else dblMultiplier = 2 ^ bytPlaces Shll = dblToLong(lngNumber * dblMultiplier) End If U_ext: Exit Function PROC_ERR: MsgBox "Error: Shll", vbCritical, "ULZ" Resume U_ext End Function Private Sub WriteBufferByte(abytOutput() As Byte, lngBytesWritten As Long, bytValue As Byte) ' ******************************************************** ' This procedure writes a single byte to the output buffer ' ******************************************************** ' abytOutput - The output buffer ' lngBytesWritten - The current position in the output buffer ' bytByte - The byte to write to the buffer Dim intCounter As Integer On Error GoTo PROC_ERR ' If eight bytes have been written, write the output buffer If mbytBitCount = 8 Then For intCounter = 0 To mbytByteCodeWritten - 1 abytOutput(lngBytesWritten) = mabytOutputBuffer(intCounter) lngBytesWritten = lngBytesWritten + 1 Next intCounter ' Reset the write variables mbytByteCodeWritten = 1 mbytBitCount = 0 mabytOutputBuffer(0) = 0 End If ' Update the output buffer mabytOutputBuffer(mbytByteCodeWritten) = bytValue ' Increment the number of bytes written mbytByteCodeWritten = mbytByteCodeWritten + 1 ' Indicate that this byte is not compressed BitSetByte mabytOutputBuffer(0), mbytBitCount 'Increment the number of entries written mbytBitCount = mbytBitCount + 1 U_ext: 'exit Exit Sub PROC_ERR: ' error message MsgBox "Error: WriteBufferByte", vbCritical, "Huffman" Resume U_ext End Sub Private Function Shri(ByVal lngValue As Long, ByVal bytPlaces As Byte) As Integer ' ******************************************************* ' Shifts a long Value right the selected number of places ' ******************************************************* ' lngValue - integer Value to shift ' bytPlaces - number of places to shift ' Returnz the Shifted value Dim lngDivisor As Long On Error GoTo PROC_ERR ' if we are shifting 16 or more bits, then the result is always zero If bytPlaces >= 16 Then Shri = 0 Else lngDivisor = 2 ^ bytPlaces Shri = Int(IntToLong(lngValue) / lngDivisor) End If U_ext: Exit Function PROC_ERR: MsgBox "Error: Shri", vbCritical, "ULZ" Resume U_ext End Function Private Sub WriteBufferEntry(abytOutput() As Byte, lngBytesWritten As Long, intPos As Integer, intLen As Integer) '********************************************************* 'this procedure writes a window entry to the output buffer '********************************************************* ' Parameterz: ' abytOutput - The output buffer ' lngBytesWritten - The current position in the output buffer ' intPos - The position of the entry ' intLen - The length of the entry Dim intCounter As Integer On Error GoTo PROC_ERR ' If eight bytes have been written, write the output buffer If mbytBitCount = 8 Then For intCounter = 0 To mbytByteCodeWritten - 1 abytOutput(lngBytesWritten) = mabytOutputBuffer(intCounter) lngBytesWritten = lngBytesWritten + 1 Next intCounter ' Reset the output varables mbytByteCodeWritten = 1 mbytBitCount = 0 mabytOutputBuffer(0) = 0 End If ' The first byte contains the loword of the position in the window mabytOutputBuffer(mbytByteCodeWritten) = IntToByte(intPos) ' Increment the number of bytes written mbytByteCodeWritten = mbytByteCodeWritten + 1 ' The second byte of an entry contains the 4 hi bits of the position, and the ' lower four bits contain the length of the match mabytOutputBuffer(mbytByteCodeWritten) = IntToByte(((Shri(intPos, 4) And &HF0&) Or intLen - mcintMinMatchLen)) ' Increment the number of bytes written mbytByteCodeWritten = mbytByteCodeWritten + 1 ' Increment the number of entries written mbytBitCount = mbytBitCount + 1 U_ext: 'exit the procedure Exit Sub PROC_ERR: ' errror message MsgBox "Error: WriteBufferEntry", vbCritical, "ULZ" Resume U_ext End Sub
分享
Access數(shù)據(jù)庫(kù)自身
- office課程播放地址及課程明細(xì)
- Excel Word PPT Access VBA等Office技巧學(xué)習(xí)平颱
- 將( .accdb) 文件格式數(shù)據(jù)庫(kù)轉(zhuǎn)換爲(wèi)早期版本(.mdb)的文件格式
- 將早期的數(shù)據(jù)庫(kù)文件格式(.mdb)轉(zhuǎn)換爲(wèi) (.accdb) 文件格式
- KB5002984:配置 Jet Red Database Engine 數(shù)據(jù)庫(kù)引擎和訪問(wèn)連接引擎以阻止對(duì)遠(yuǎn)程數(shù)據(jù)庫(kù)的訪問(wèn)(remote table)
- Access 365 /Access 2019 數(shù)據(jù)庫(kù)中哪些函數(shù)功能和屬性被沙箱模式阻止(如未啟動(dòng)宏時(shí))
- Access Runtime(運(yùn)行時(shí))最全的下載(2007 2010 2013 2016 2019 Access 365)
Access VBA函數(shù)模塊
- access vba代碼太長(zhǎng),換行,分行的寫(xiě)法
- VB6 VBA Access真正可用併且完美支持中英文的 URLEncode 與 URLDecode 函數(shù)源碼
- 自定義VB中的urlencode函數(shù),將URL中特殊部分進(jìn)行編碼
- Access 函數(shù)簡(jiǎn)化串接sql字符串,減少符號(hào)導(dǎo)緻的書(shū)寫(xiě)錯(cuò)誤
- vba完全關(guān)閉IE瀏覽器及調(diào)用IE瀏覽器的簡(jiǎn)單應(yīng)用
- 利用FollowHyperlink方法打開(kāi)超鏈接提示“無(wú)法下載您要求的信息”的解決方案
- 在access中用代碼打開(kāi)文本框中超鏈接地址
Access Activex第三方控件
- Activex控件或Dll 在某些電腦無(wú)法正常註冊(cè)的解決辦法(regsvr32註冊(cè)時(shí)卡?。?/a>
- office使用部分控件時(shí)提示“您沒(méi)有使用該ActiveX控件許可的問(wèn)題”的解決方法
- RTF文件(富文本格式)的一些解析
- Access樹(shù)控件(treeview) 64位Office下齣現(xiàn)橫曏滾動(dòng)條不會(huì)自動(dòng)定位的解決辦法
- Access中國(guó)樹(shù)控件 在win10電腦 節(jié)點(diǎn)行間距太小的解決辦法
- EXCEL 2019 64位版(Office 2019 64位)早就支持64位Treeview 樹(shù)控件 ListView列錶等64位MSCOMMCTL.OCX控件下載
- VBA或VB6調(diào)用WebService(直接Post方式)併解析返迴的XML
Access ADP Sql Server等
- 早期PB程序連接Sqlserver齣現(xiàn)錯(cuò)誤
- MMC 不能打開(kāi)文件C:/Program Files/Microsoft SQL Server/80/Tools/Binn/SQL Server Enterprise Manager.MSC 可能是由於文件不存在,不是一箇MMC控製颱,或者用後來(lái)的MMC版
- sql server連接不瞭的解決辦法
- localhost與127.0.0.1區(qū)彆
- Roych的淺談數(shù)據(jù)庫(kù)開(kāi)髮繫列(Sql Server)
- sqlserver 自動(dòng)備份對(duì)備份目録沒(méi)有存取權(quán)限的解決辦法
- 安裝Sql server 2005 express 和SQLServer2005 Express版企業(yè)管理器 SQLServer2005_SSMSEE
Access 行業(yè)應(yīng)用開(kāi)髮
- 金蝶KIS旂艦版 登録時(shí)“類(lèi)型不匹配”
- access行業(yè)交流QQ群-部分行業(yè)交流群(倉(cāng)庫(kù) 人事 工資 考勤 CRM HRM MRP ERP 等)
- access垃圾分類(lèi)數(shù)據(jù)庫(kù)
- Office提高企業(yè)辦公管理效率
- Access交流網(wǎng)Acccess通用開(kāi)髮平颱樹(shù)導(dǎo)航齣錯(cuò)的解決辦法
- Access交流網(wǎng)Access通用開(kāi)髮平颱的使用幫助教程及FAQ
- Access採(cǎi)購(gòu)倉(cāng)庫(kù)繫統(tǒng)作品源代碼
文章分類(lèi)
聯(lián)繫我們
聯(lián)繫人: | 王先生 |
---|---|
Email: | 18449932@qq.com |
QQ: | 18449932 |
微博: | officecn01 |