(宣告:魏滔序原創,轉貼請註明出處。)
option explicit
'declares
private declare sub copymemory lib "kernel32" alias "rtlmovememory" (hpvdest as any, hpvsource as any, byval cbcopy as long)
private declare function compress lib "zlibwapi.dll" alias "compress" (dest as any, destlen as any, src as any, byval srclen as long) as long
private declare function uncompress lib "zlibwapi.dll" (dest as any, destlen as any, src as any, byval srclen as long) as long
private const offset as long = &h8
'壓縮陣列
public function compressbyte(bytearray() as byte) as boolean
dim buffersize as long
dim tempbuffer() as byte
'create a buffer to hold the compressed data
buffersize = ubound(bytearray) + 1
buffersize = buffersize + (buffersize * 0.01) + 12
redim tempbuffer(buffersize)
'compress byte array (data)
compressbyte = (compress(tempbuffer(0), buffersize, bytearray(0), ubound(bytearray) + 1) = 0)
'add the size of the original data
call copymemory(bytearray(0), clng(ubound(bytearray) + 1), offset)
'remove redundant data
redim preserve bytearray(0 to buffersize + offset - 1)
copymemory bytearray(offset), tempbuffer(0), buffersize
end function
'解壓縮陣列
public function uncompressbyte(bytearray() as byte) as boolean
dim origlen as long
dim buffersize as long
dim tempbuffer() as byte
'get the original size
call copymemory(origlen, bytearray(0), offset)
'create a buffer to hold the uncompressed data
buffersize = origlen
buffersize = buffersize + (buffersize * 0.01) + 12
redim tempbuffer(buffersize)
'decompress data
uncompressbyte = (uncompress(tempbuffer(0), buffersize, bytearray(offset), ubound(bytearray) - offset + 1) = 0)
'remove redundant data
redim preserve bytearray(0 to buffersize - 1)
copymemory bytearray(0), tempbuffer(0), buffersize
end function
VB6中用DataReport做報表
vb6中用datareport做報表 2002 01 08 李 yesky 我不是vb熟練工,最近剛剛用vb做完乙個程式,其中控制部分沒費太大周折,倒是報表部分頗讓我費了一翻腦筋。在網上找了半天,也沒找到關於vb6的 datareport的詳細介紹,於是想借鑑 前輩 們的經驗,用crystalrep...
VB6中用DataReport做報表
vb6中用datareport做報表 首先介紹一下datareport物件的幾個常用屬性。一是datasource,用於設定乙個資料來源,通過該資料來源,資料使用者被繫結到乙個資料庫 二是datamember,從datasource提供的幾個資料成員中設定乙個特定的資料成員 三是leftmargin...
VB6中用DataReport做報表
首先介紹一下datareport物件的幾個常用屬性。一是datasource,用於設定乙個資料來源,通過該資料來源,資料使用者被繫結到乙個資料庫 二是datamember,從datasource提供的幾個資料成員中設定乙個特定的資料成員 三是leftmargin rightmargin topmar...