To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Article :: Building Dynamic Systems with Expressions in .NET
How Is XML Like An Interface?
Understanding Covariance and Contravariance
Print VS 2010 Keyboard Shortcut References in Letter (8.5x11in) and A4 (210×297mm) Sizes
Updated Productivity Power Tools



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Aug 20th, 2005, 07:03 PM   #1
abazabam
Hyperactive Member
 
Join Date: Jul 05
Posts: 400
abazabam is an unknown quantity at this point (<10)
ZIP Compression Using Pure Visual Basic

Does anyone have any kind of module, class module, etc. that can compress files using ZIP compression?
abazabam is offline   Reply With Quote
Old Aug 20th, 2005, 07:15 PM   #2
TheVader
Fanatic Member
 
TheVader's Avatar
 
Join Date: Oct 02
Location: Rotterdam, the Netherlands
Posts: 871
TheVader will become famous soon enough (65+)
Re: ZIP Compression Using Pure Visual Basic

vbAccelerator.com has a freeware zip library; though I don't believe it's been written in VB6...
__________________
Author for Visual Basic Web Magazine
My articles on the Web Browser Control:
Using the Web Browser Control & Using the DHTML Document Object Model

The examples referenced in the articles can be found here:
TheVader is offline   Reply With Quote
Old Aug 20th, 2005, 07:23 PM   #3
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

No it's not (well not completely) - it's just a wrapper for infozip.dll - same dll winzip's using.
RhinoBull is offline   Reply With Quote
Old Aug 20th, 2005, 08:02 PM   #4
abazabam
Hyperactive Member
 
Join Date: Jul 05
Posts: 400
abazabam is an unknown quantity at this point (<10)
Re: ZIP Compression Using Pure Visual Basic

I already know about those. I'm trying to find a module, class module, etc. for it. I don't like using dlls and ocxs.
abazabam is offline   Reply With Quote
Old Aug 20th, 2005, 08:11 PM   #5
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Not much help here, very likely you just have to code it by yourself.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Old Aug 20th, 2005, 08:12 PM   #6
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

VB isn't capable of doing such stuff on its own - you must use some library and the one from vbAccelerator comes very handy (also full source is available). So, if you don't like it then you pretty much on your own.
RhinoBull is offline   Reply With Quote
Old Aug 20th, 2005, 08:23 PM   #7
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by RhinoBull
VB isn't capable of doing such stuff on its own - you must use some library and the one from vbAccelerator comes very handy (also full source is available). So, if you don't like it then you pretty much on your own.
Err... don't push out such lies so easily. VB can do it very well (like about any other programming language out there), nobody just haven't bothered to do it since there are already-made solutions available.

inventrex: the easiest solution is just to use external DLL. Can't really rely that a user has Windows XP or WinZip (I use IZarc and have disabled WinXP's own ZIP functionality in my other computer).
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Old Aug 20th, 2005, 08:32 PM   #8
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by Merri
Err... don't push out such lies so easily. VB can do it very well (like about any other programming language out there), nobody just haven't bothered to do it since there are already-made solutions available. ...
I don't really like, Merri, the way you express yourself so next time watch it.
Anyway, there were plenty of attempts in VB but non of them succeeded - whould that mean anything to you at all ???
RhinoBull is offline   Reply With Quote
Old Aug 20th, 2005, 08:39 PM   #9
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

I don't like your way either so we're equal on that. On the topic: it just means not everyone have the skills to do it; ZIP format is pretty feature rich as it is. ZIP File Format Specification has a lot of text in it.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Old Aug 20th, 2005, 08:48 PM   #10
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

No, we are not equal and next time you call me lying - watch it ... Also, why don't you give it the try smarty ...
RhinoBull is offline   Reply With Quote
Old Aug 20th, 2005, 09:06 PM   #11
abazabam
Hyperactive Member
 
Join Date: Jul 05
Posts: 400
abazabam is an unknown quantity at this point (<10)
Re: ZIP Compression Using Pure Visual Basic

If there is none, can someone please give me the function for the best compression that you know of?
abazabam is offline   Reply With Quote
Old Aug 21st, 2005, 01:07 AM   #12
penagate
Super Moderator
 
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,716
penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)
Re: ZIP Compression Using Pure Visual Basic

Here is the full link to the zip page on vbAccelerator.

IMO, you could write it yourself in VB fairly straightforwardly, all you need to do is learn the algorithm (compression method) and just code that.
penagate is offline   Reply With Quote
Old Aug 21st, 2005, 01:09 AM   #13
abazabam
Hyperactive Member
 
Join Date: Jul 05
Posts: 400
abazabam is an unknown quantity at this point (<10)
Re: ZIP Compression Using Pure Visual Basic

I already tried that but I don't know like using dlls or ocxs. I'm just a beginner, so I need to see as much code examples as possible.
abazabam is offline   Reply With Quote
Old Aug 21st, 2005, 01:20 AM   #14
penagate
Super Moderator
 
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,716
penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)
Re: ZIP Compression Using Pure Visual Basic

DLLs are good, they reduce the amount of code you have to write yourself... If you're just a beginner you should learn how to use DLLs and OCXs instead of just ignoring them. Trust me, eventually you won't be able to work without them, so better to start using them earlier
penagate is offline   Reply With Quote
Old Aug 21st, 2005, 01:25 AM   #15
abazabam
Hyperactive Member
 
Join Date: Jul 05
Posts: 400
abazabam is an unknown quantity at this point (<10)
Re: ZIP Compression Using Pure Visual Basic

It just doesn't seem right using dlls and ocx created using C++ in a Visual Basic project. I'm sure that Visual Basic can do as much as C++ can, but no one wants to give away any of their source codes.
abazabam is offline   Reply With Quote
Old Aug 21st, 2005, 01:29 AM   #16
penagate
Super Moderator
 
Join Date: Jan 05
Location: Sunny Adelaide
Posts: 12,716
penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)penagate has much to be proud of (1500+)
Re: ZIP Compression Using Pure Visual Basic

Well, if you find any. I believe Rhino when he says that people have tried and failed, although I'm more inclined to believe they gave up

As I said, you could do it yourself. There isn't source code for everything.

And BTW, VB can do pretty much as much as C++, but the more you get out of the VB "comfort zone" and into more advanced topics, the more roundabout and fiddly code you are gonna need.
penagate is offline   Reply With Quote
Old Aug 21st, 2005, 05:52 AM   #17
dreamvb
Hyperactive Member
 
Join Date: Aug 02
Location: UK
Posts: 417
dreamvb will become famous soon enough (50+)
Re: ZIP Compression Using Pure Visual Basic

Well I not seen any code as yet that can Create Zip files from VB Code. Tho I did once find an Opensource VB Program that allows you to extract from Zip files, but that not you want is it.

I did come accross this tho
Deflate64/Inflate64 for coders

http://www.pscode.com/vb/scripts/Sho...58473&lngWId=1
there also some other good compression stuff on the site as well.
__________________
When your dreams come true.
On error resume pulling hair out.
dreamvb is offline   Reply With Quote
Old Aug 21st, 2005, 10:55 AM   #18
rm_03
Lively Member
 
rm_03's Avatar
 
Join Date: Aug 04
Posts: 92
rm_03  is on a distinguished road (30+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
there also some other good compression stuff on the site as well.
Yes, like:
http://www.pscode.com/vb/scripts/Sho...53174&lngWId=1

/edit:
BTW, where does all this "VB can't do this, use C!!" stuff come from?
The only things VB can't do is drivers, safe multi threading (at least as standard EXE) and direct low level IO.
And creating ZIP files is far away from being low level ;-)

Last edited by rm_03; Aug 21st, 2005 at 11:06 AM.
rm_03 is offline   Reply With Quote
Old Aug 21st, 2005, 11:40 AM   #19
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

I understand I flamed this thread abit, HOWEVER I will be proven wrong ONLY if someone shows me a really working example of "creating zip file using pure any pre dot net vb" and it has to perform just like Winzip, RAR, PKZip and/or some others do - it could better but not lousy. Until then it's all going to be speculations. Sorry.
RhinoBull is offline   Reply With Quote
Old Aug 21st, 2005, 12:06 PM   #20
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by rm_03
BTW, where does all this "VB can't do this, use C!!" stuff come from?
It comes from the 90's when C++ got a lot of fanboys and they bashed VB all they could. Atleast, that is one of the main reasons.

Rhino: what you're trying to say is that VB couldn't handle reading and writing a file. A ZIP is a file, thus is made of bits. You can handle bits with VB (And, Or, Xor, bitshifting with some trick code). Reading and writing a ZIP file is just converting data from a format to another.

You can find a JPEG compressor over at PSC, which saves JPG files. Also, I've made a MIX file reader and writer using VB: MIX files are from Command & Conquer, which is a archive format without actual compression by the file format itself as the contents that were stored were already compressed; which is very much like ZIP. ZIP compresses individual files and acts otherwise as an archive. Too bad I lost the source for that when my harddisk failed a few years ago... not that C&C or Red Alert would be interesting these days.

I have also made a Settlers II map reader and writer which contains multiple map data for a single map... quite similar to archive file, though lacks details for filenames. For Transport Tycoon I have a reader for GFX files (contains multiple compressed graphics files), though I never got as far as writing the code for saving a file. I could have.

These should be enough to proof ZIP file reading and saving can be done with VB. WinZip, PKzip and the like use ASM optimized code, so you just can't beat them with higher level languages no matter what you do. You could make the speed quite good though.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Old Aug 21st, 2005, 12:29 PM   #21
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by Merri
... A ZIP is a file, thus is made of bits. You can handle bits with VB (And, Or, Xor, bitshifting with some trick code). ...
That's correct.

Quote:
Originally Posted by Merri
... Reading and writing a ZIP file is just converting data from a format to another. ...
That's where the problem resides.
RhinoBull is offline   Reply With Quote
Old Aug 21st, 2005, 01:04 PM   #22
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Right. Believe it as you wish, for the sake of having a differing opinion. I haven't seen anything that proves against. "That's where the problem resides" doesn't really tell why there would be a problem or why VB couldn't do it.

Enjoy your "I won!" dance, won't comment on this any more.


The Proof: "This code can be used to create filetypes wich used Deflate as compression algo (ZIP,GZIP,CAB, etc.etc)" (mentioned earlier in this very thread)


Edit Fixed typo.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »

Last edited by Merri; Aug 21st, 2005 at 02:43 PM.
Merri is offline   Reply With Quote
Old Aug 21st, 2005, 02:57 PM   #24
eranfox
Hyperactive Member
 
eranfox's Avatar
 
Join Date: May 01
Posts: 492
eranfox  is on a distinguished road (30+)
Re: ZIP Compression Using Pure Visual Basic

Reply to abazabam,
Hello abazabam,
You can try winzip Comand line

download this 2 files from http://www.winzip.com/downcl.htm

1)WinZip 9.0
2)Command Line Support Add-On 1.1 SR-1

than read the documentation about Command Line Support Add-On 1.1 SR-1

i wrote a VB code using a batch file:

VB Code:
  1. Call Shell("C:\myBatch.bat", vbMaximizedFocus)

inside myBatch i used the wwzip command:
Code:
C:\wzzip C:\myZip.zip C:\*.pdf
All the pdf file will be zip to one zip file called myZip.zip

Best Regards,
ERAN
__________________
Eran Fox
ASSEMBLER,C,C++,VB6,SQL...
eranfox is offline   Reply With Quote
Old Aug 21st, 2005, 03:34 PM   #25
rm_03
Lively Member
 
rm_03's Avatar
 
Join Date: Aug 04
Posts: 92
rm_03  is on a distinguished road (30+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by RhinoBull
I would enjoy it more if someone proves me wrong, though.
I hope you will enjoy this

1) Download the project from the link I posted.
2) Open cls_Zip.cls.
3) Add the following type:
Code:
Private Type Pack_Helper_Type
    valid   As Long
    CRC32   As Long
    USize   As Long
    CSize   As Long
    offset  As Long
End Type
4) Overwrite the "pack" function with the following:
Code:
Public Function Pack(ZipName As String, files() As String, CompLevel As Integer) As Integer
    Dim CentDat         As Central_Header_Type
    Dim helpers()       As Pack_Helper_Type
    Dim EndCentralSig   As End_Header_Type

    Dim fhIN        As Integer, fhOUT       As Integer
    Dim i           As Integer

    Dim lngSig      As Long, lngCenOff      As Long

    ReDim helpers(LBound(files) To UBound(files))

    fhOUT = FreeFile
    Open ZipName For Binary As #fhOUT

    For i = LBound(files) To UBound(files)
        If Not Trim$(files(i)) = vbNullString Then
            helpers(i) = AppCompFile(fhOUT, files(i), CompLevel)
        End If
    Next

    lngSig = &H2014B50
    lngCenOff = Seek(fhOUT) - 1

    For i = LBound(helpers) To UBound(helpers)
        With CentDat
            .CRC32 = helpers(i).CRC32
            .CSize = helpers(i).CSize
            .offset = helpers(i).offset
            .USize = helpers(i).USize
            .LenFname = Len(GetFile(files(i)))
            .Method = CompLevel
            .VerExt = 20
            .VerMade = 20
        End With
        Put #fhOUT, , lngSig
        Put #fhOUT, , CentDat
        Put #fhOUT, , CStr(GetFile(files(i)))
    Next

    lngSig = &H6054B50

    With EndCentralSig
        .signature = lngSig
        .Entries = UBound(files) - LBound(files) + 1
        .TotEntr = .Entries
        .CenOff = lngCenOff
        .CenSize = Seek(fhOUT) - 1 - lngCenOff
    End With

    Put #fhOUT, , EndCentralSig

    Close #fhOUT

End Function

Private Function AppCompFile(ByVal fh As Integer, ByVal file As String, ByVal level As Integer) As Pack_Helper_Type

    'On Error GoTo OnError

    Dim LocDat                As Local_Header_Type

    Dim fhIN                  As Integer
    Dim btFile()              As Byte

    Dim lngSig                As Long

    AppCompFile.offset = Seek(fh) - 1

    fhIN = FreeFile
    Open file For Binary As #fhIN
        ReDim btFile(LOF(fhIN) - 1) As Byte
        Get #fhIN, , btFile
    Close #fhIN

    LocDat.USize = UBound(btFile) + 1
    LocDat.CRC32 = CRC.CalcCRC32File(btFile)

    Deflate btFile, level, False

    With LocDat
        .CSize = UBound(btFile) + 1
        .LenFname = Len(GetFile(file))
        .Method = level
        .VerExt = 20
    End With

    lngSig = &H4034B50

    Put #fh, , lngSig
    Put #fh, , LocDat
    Put #fh, , CStr(GetFile(file))
    Put #fh, , btFile

    With AppCompFile
        .CRC32 = LocDat.CRC32
        .CSize = LocDat.CSize
        .USize = LocDat.USize
        .valid = 1
    End With

OnError:

End Function

Private Function GetFile(file As String) As String
    GetFile = Mid$(file, InStrRev(file, "\") + 1)
End Function
Example on how to use this function:
Code:
Option Explicit

Dim p   As New cls_Zip

Private Sub Form_Load()
    Dim files(0)    As String
    files(0) = "C:\export.def"
    p.Pack "C:\new.zip", files, 8
End Sub
I've done this in about 1 1/2 hours, so you can only add files to the root.
You want a feature, add it.

/edit: Oups, I forgot, you have to add the Deflate module from DreamVB`s link.

Last edited by rm_03; Aug 21st, 2005 at 03:44 PM.
rm_03 is offline   Reply With Quote
Old Aug 22nd, 2005, 04:03 AM   #27
rm_03
Lively Member
 
rm_03's Avatar
 
Join Date: Aug 04
Posts: 92
rm_03  is on a distinguished road (30+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by RhinoBull
That proves nothing more than the fact that you can create files in VB.
I don't get it...

1) The question was: code to compress a file with ZIP compression
2) You said: Can't be done in VB.
3) dreamvb posted a link to modules that show the Deflate/Inflate algorithms used in Zip files. Disproof of your statement.
4) You said you want a working example on how to create a Zip file with VB classic.
What you said with this is: You don't believe VB has arithmetic operators and can do file IO. The converse was proved just when VB was released some years ago.
5) I posted a working example on how to create the Zip file structure with compressed data in it.
6) You said: "This only proofs VB can do file IO".

Right... If VB creates a ZIP file, it's file IO.
If WinZip creates a ZIP file, it's a ZIP file.

This is ridiculous...
rm_03 is offline   Reply With Quote
Old Aug 22nd, 2005, 04:11 AM   #28
Devion
Frenzied Member
 
Devion's Avatar
 
Join Date: Sep 00
Location: The Netherlands
Posts: 1,049
Devion  is on a distinguished road (40+)
Re: ZIP Compression Using Pure Visual Basic

Reading this thread reminded me of all the people saying VB didn't support pointers...
Anyway; I agree with RM_03, VB can do pure File IO/Compression/Decompression without a problem it's just that no one actually thought about doing it due to the freeware/open source libraries available (ZLib, etc).

Quote:
Yeah, I also dislike using external files.
MSVBVM60.DLL or MSVBVM50.DLL ring a bell? - In other words you'll always be depending on external files to run your projects. One more or less doesn't really make a difference
__________________
Capellan Conflict:
http://www.vbforums.com/showthread.php?p=2358448
Devion is offline   Reply With Quote
Old Aug 22nd, 2005, 04:16 AM   #29
dee-u
Software Carpenter
 
dee-u's Avatar
 
Join Date: Feb 05
Location: Philippines
Posts: 9,650
dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)dee-u is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

I hope this helps.
dee-u is offline   Reply With Quote
Old Aug 22nd, 2005, 07:37 AM   #30
namrekka
Hyperactive Member
 
namrekka's Avatar
 
Join Date: Feb 05
Location: Netherlands
Posts: 378
namrekka is on a distinguished road (20+)
Re: ZIP Compression Using Pure Visual Basic

Come on guys, don't fight because of some bytes and bits!
Share your knowledge!
namrekka is offline   Reply With Quote
Old Aug 22nd, 2005, 07:50 AM   #31
chemicalNova
G&G Moderator
 
chemicalNova's Avatar
 
Join Date: Jun 02
Location: Victoria, Australia
Posts: 4,245
chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by Devion
MSVBVM60.DLL or MSVBVM50.DLL ring a bell? - In other words you'll always be depending on external files to run your projects. One more or less doesn't really make a difference
Technically, 1 less would make a difference

chem
__________________

Visual Studio 6, Visual Studio.NET 2005, MASM
chemicalNova is offline   Reply With Quote
Old Aug 22nd, 2005, 08:06 AM   #32
RhinoBull
PowerPoster
 
RhinoBull's Avatar
 
Join Date: Mar 04
Location: New Amsterdam
Posts: 21,024
RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)RhinoBull is a name known to all (1000+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
this is childish ,silly and stubborn
That's a qoute of from neg rep comments someone (probably rm_03 - sorry if not) gave me for my post in this thread (last prior to this) so it is silly to rep for an opinion. BTW, I don't really give a damn thing about it.

Anyway, that sample really proves nothing but what I previously said: there were plenty of attempts but non of them performed like Winzip, RAR or say PKZip and that's what matters. I did say that VB "isn't capable" so maybe I should've had said "lousy performer" in this regards instead, well ... perhaps ...
Also, as Merri pinted out Winzip, RAR and others use "ASM optimized code" so there is no way to beat that performance and it's a most important thing: who's going to use your pure VB compressor if it takes 30 min when it may 30 sec ... And you call that "childish ,silly and stubborn"? Stubborn maybe, but certainly not childish and/or silly.

My best regards - especially to the person who neg rep me.
RhinoBull is offline   Reply With Quote
Old Aug 22nd, 2005, 08:08 AM   #33
chemicalNova
G&G Moderator
 
chemicalNova's Avatar
 
Join Date: Jun 02
Location: Victoria, Australia
Posts: 4,245
chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)
Re: ZIP Compression Using Pure Visual Basic

What he means is, the code doesn't answer the question. I don't know why many of you are finding it so hard to understand.

RhinoBull said what he said, because the code given doesn't prove the original argument; that VB can write ZIP compression in PURE VB.

chem
__________________

Visual Studio 6, Visual Studio.NET 2005, MASM
chemicalNova is offline   Reply With Quote
Old Aug 22nd, 2005, 08:10 AM   #34
Devion
Frenzied Member
 
Devion's Avatar
 
Join Date: Sep 00
Location: The Netherlands
Posts: 1,049
Devion  is on a distinguished road (40+)
Re: ZIP Compression Using Pure Visual Basic

Getting a neg rep from this.. mmh.. I'll refrain from saying something stupid

Anyway; VB can use asm optimized code also so that wouldn't be a issue. If we are going for a really pure without any api's etc version of a unzipper/zipper mmh.. it would be slow on large files but it's still doable
__________________
Capellan Conflict:
http://www.vbforums.com/showthread.php?p=2358448
Devion is offline   Reply With Quote
Old Aug 22nd, 2005, 08:12 AM   #35
chemicalNova
G&G Moderator
 
chemicalNova's Avatar
 
Join Date: Jun 02
Location: Victoria, Australia
Posts: 4,245
chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)
Re: ZIP Compression Using Pure Visual Basic

I'd like to see someone attempt this, then I could try and port it to ASM

chem
__________________

Visual Studio 6, Visual Studio.NET 2005, MASM
chemicalNova is offline   Reply With Quote
Old Aug 22nd, 2005, 08:15 AM   #36
Devion
Frenzied Member
 
Devion's Avatar
 
Join Date: Sep 00
Location: The Netherlands
Posts: 1,049
Devion  is on a distinguished road (40+)
Re: ZIP Compression Using Pure Visual Basic

I'll take the challenge :-)
__________________
Capellan Conflict:
http://www.vbforums.com/showthread.php?p=2358448
Devion is offline   Reply With Quote
Old Aug 22nd, 2005, 08:40 AM   #37
chemicalNova
G&G Moderator
 
chemicalNova's Avatar
 
Join Date: Jun 02
Location: Victoria, Australia
Posts: 4,245
chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)
Re: ZIP Compression Using Pure Visual Basic

inventrex: Have you looked at the traffic on your ports while using MSN Plus!? I have a post somewhere else which says MSN Plus, while running, sends POST (?) requests to websites which the MSN Plus creator gets paid for having visitors. You know those online things that say you get $0.50 for every person who visits this site using the link we give you? He did that. netstat -a if I remember correctly. Technically, he is being paid for the thousands of people who are using his program. Personally, I would like a massive banner across the program saying this is happening, before using an "illegal" add-on like that.

(PS: Saw the Petition in your sig)

chem
__________________

Visual Studio 6, Visual Studio.NET 2005, MASM
chemicalNova is offline   Reply With Quote
Old Aug 22nd, 2005, 08:44 AM   #38
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by RhinoBull
Also, as Merri pinted out Winzip, RAR and others use "ASM optimized code" so there is no way to beat that performance and it's a most important thing: who's going to use your pure VB compressor if it takes 30 min when it may 30 sec
Maybe more like 40 - 60 seconds than 30 minutes (thus somewhat identical to pure C/C++ implementation). With proper optimizations you can do "miracles". A lot of ZIP compression is just low level math which can be done real fast no matter what the language. With ASM you can just get much more control over it as there are more specific commands one can use... it just takes darn long to write it all in ASM.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Old Aug 22nd, 2005, 08:49 AM   #39
Devion
Frenzied Member
 
Devion's Avatar
 
Join Date: Sep 00
Location: The Netherlands
Posts: 1,049
Devion  is on a distinguished road (40+)
Re: ZIP Compression Using Pure Visual Basic

Quote:
Originally Posted by Merri
Maybe more like 40 - 60 seconds than 30 minutes (thus somewhat identical to pure C/C++ implementation). With proper optimizations you can do "miracles". A lot of ZIP compression is just low level math which can be done real fast no matter what the language. With ASM you can just get much more control over it as there are more specific commands one can use... it just takes darn long to write it all in ASM.
The time you are busy making it in asm you get back by the fast computations done
__________________
Capellan Conflict:
http://www.vbforums.com/showthread.php?p=2358448
Devion is offline   Reply With Quote
Old Aug 22nd, 2005, 09:04 AM   #40
Merri
VB6, XHTML & CSS hobbyist
 
Merri's Avatar
 
Join Date: Oct 02
Location: Finland
Posts: 6,330
Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)Merri is a splendid one to behold (700+)
Re: ZIP Compression Using Pure Visual Basic

Yeah, but the thing is... that wasn't my point. It is already done in ASM. Just go grab Info-ZIP source code and you can use it inline in any compiler that supports inline ASM (afaik). VB6 is of course out of the list, though you can still use the ASM optimized DLL. That is if you want ASM optimized. VB6 optimized would be good enough for many cases, the only time one has a special need for the most extreme speed is when you compress a lot of files (thousands) or if you compress very big files. And even then it might be the computer harddisk which cause the most slowdown, knowing the processing power of a modern computer.
__________________
Unicode classes, functions... in Visual Basic 6

VB6 in occasional use. I'm mostly HTML, CSS & JavaScript these days.
« Antec Sonata II: Core 2 Duo E7400, ASRock P45TS, Asus EN9600GT 512 MB, 4 GB, 1.25 TB »
« OS: Windows 7 | Laptop: Amilo Pi 2530-12P| Netbook: Asus EEE 901 »
Merri is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:54 PM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.