exp. писал(а):меня интересует пара вопросов..
1.как извлечь только 1файл при помощи zlibwapi.dll?
если имя заранее известно..
exp. писал(а):2.можно ли выгрузить компонент, во время
работы..напримерCommonDialog..если да, то как??
3.почему VB приложения заимают так много оперативной памяти??
и как уменьшить..
В документации по zlib разве не написано?
Какой компонент? Зачем выгружать? Ради экономии памяти?
Много? 0,7 Гб чтоли?
контролировать объем выделяемой для работы памяти в программе на VB нельзя.
exp. писал(а):ну хотя бы ответьте как запихнуть программу в cmd или пуск выпольнить(хотя это одно и тоже..)
не меняя ее места...
например моя прога находится %program files%\myprog\run.exe
чтобы, если в cmd написать run , запускалась моя программа..
exp. писал(а):и заодно.. как узнать,куда установлен winrar..
ReDim MindStream as myMind
Set MindStream = New RussianLanguage
Скопировать ее в папку Windows.
Private Declare Function uncompress Lib "ZLibWAPI.dll" (ByRef dest As Any, ByRef destLen As Long, ByRef source As Any, ByVal sourceLen As Long) As Long
Private Declare Function compress Lib "ZLibWAPI.dll" (ByRef dest As Any, ByRef destLen As Long, ByRef source As Any, ByVal sourceLen As Long) As Long
Private Declare Function compressBound Lib "ZLibWAPI.dll" (ByVal sourceLen As Long) As Long
Private Declare Function uncompress Lib "ZLibWAPI.dll" (ByRef dest As Any, ByRef destLen As Long, ByRef source As Any, ByVal sourceLen As Long) As Long
Private Const Z_OK As Long = &H0
Private Sub Main()
Dim FileData() As Byte, FileSize As Long
Dim CompressBuf() As Byte, CompressLen As Long
Dim DecompressBuf() As Byte, DecompressLen As Long
Dim RetVal As Long
Dim FileName As String
FileName = "X:\Path\File.xyz"
FileSize = FileToBuf(FileName, FileData())
If (FileSize > 0) Then
CompressLen = compressBound(FileSize)
ReDim CompressBuf(0 To (CompressLen - 1)) As Byte
RetVal = compress(CompressBuf(0), CompressLen, FileData(0), FileSize)
If (RetVal = Z_OK) Then
Debug.Print "Compression succeeded"
DecompressLen = FileSize
ReDim DecompressBuf(0 To (DecompressLen - 1)) As Byte
RetVal = uncompress(DecompressBuf(0), DecompressLen, CompressBuf(0), CompressLen)
If (RetVal = Z_OK) Then
Debug.Print "Decompression succeeded, result size: " & DecompressLen & " bytes"
Else
Debug.Print "Decompress failed.."
End If
Else
Debug.Print "Compression failed.."
End If
End If
End Sub
Private Function FileToBuf(ByRef inFile As String, ByRef outBuf() As Byte) As Long
Dim FNum As Integer
Dim RetBuf() As Byte
If (Not FileExist(inFile)) Then Exit Function
FNum = FreeFile()
Open inFile For Binary Access Read Lock Write As #FNum
ReDim RetBuf(0 To (LOF(FNum) - 1)) As Byte
Get #FNum, , RetBuf()
Close #FNum
outBuf = RetBuf
FileToBuf = UBound(RetBuf) + 1
End Function
Private Function FileExist(ByRef inFile As String) As Boolean
On Error Resume Next
FileExist = CBool(FileLen(inFile) + 1)
End Function
ну помогие... что не так?
если убрать compress, то и uncompress не работает..
и куда это все сохраняется чтото никак не пойму..
как потом сохранить все это в виде файлов?..
понятно, если файл один, а если их много..
почему decompress не работает без compress?
О чём идёт речь? Как можно распаковать то, что не запаковано? Откуда берёшь данные для uncompress?
Private Declare Function compress Lib "ZLibWAPI.dll" (ByRef dest As Any, ByRef destLen As Long, ByRef source As Any, ByVal sourceLen As Long) As Long
Private Declare Function compressBound Lib "ZLibWAPI.dll" (ByVal sourceLen As Long) As Long
Private Declare Function uncompress Lib "ZLibWAPI.dll" (ByRef dest As Any, ByRef destLen As Long, ByRef source As Any, ByVal sourceLen As Long) As Long
Private Const Z_OK As Long = &H0
Private Sub Main()
Dim FileData() As Byte, FileSize As Long
Dim CompressBuf() As Byte, CompressLen As Long
Dim DecompressBuf() As Byte, DecompressLen As Long
Dim RetVal As Long
Dim FileName As String
FileName = "X:\Path\File.xyz"
FileSize = FileToBuf(FileName, FileData())
If (FileSize > 0) Then
CompressLen = compressBound(FileSize)
ReDim CompressBuf(0 To (CompressLen - 1)) As Byte
DecompressLen = FileSize
ReDim DecompressBuf(0 To (DecompressLen - 1)) As Byte
RetVal = uncompress(DecompressBuf(0), DecompressLen, CompressBuf(0), CompressLen)
If (RetVal = Z_OK) Then
Debug.Print "Decompression succeeded, result size: " & DecompressLen & " bytes"
Else
Debug.Print "Decompress failed.."
End If
End If
End Sub
Private Function FileToBuf(ByRef inFile As String, ByRef outBuf() As Byte) As Long
Dim FNum As Integer
Dim RetBuf() As Byte
If (Not FileExist(inFile)) Then Exit Function
FNum = FreeFile()
Open inFile For Binary Access Read Lock Write As #FNum
ReDim RetBuf(0 To (LOF(FNum) - 1)) As Byte
Get #FNum, , RetBuf()
Close #FNum
outBuf = RetBuf
FileToBuf = UBound(RetBuf) + 1
End Function
Private Function FileExist(ByRef inFile As String) As Boolean
On Error Resume Next
FileExist = CBool(FileLen(inFile) + 1)
End Function
Сейчас этот форум просматривают: AhrefsBot, Google-бот и гости: 115