Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor


VB Strings
VB Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Create an In-Memory Zip File

Download Chilkat Zip ActiveX

Create an in-memory Zip file. The WriteToMemory method returns a Variant byte array that is an exact image of a Zip file. If the Variant is written to disk a valid Zip file is produced. One may also do other things with the in-memory Zip, such as storing it in a database field, or sending it across a communications channel to another program.


Private Sub Command2_Click()
    
    Dim ZipFile As ChilkatZip2
    Dim vByteData As Variant
    
    Set ZipFile = New ChilkatZip2
    ZipFile.UnlockComponent "30-day trial"
    ZipFile.NewZip "hamlet.zip"

    'Add something to our Zip.
    success = ZipFile.AppendOneFileOrDir("hamlet.xml", 0)
    If (success = 0) Then
        MsgBox ZipFile.LastErrorText
        Exit Sub
    End If
    
    'Write the Zip file into memory.
    ' (We would normally call WriteZip to write a Zip file, but this
    ' example is to demonstrate how an image of the Zip can be written
    ' to memory.  One might write a program to Zip to memory and then
    ' send it over a TCP socket connection, for example.)
    vByteData = ZipFile.WriteToMemory()
    
    'Save the byte data to a file.
    Open "hamlet.zip" For Binary As #1
    Put #1, , vByteData
    Close #1
    
    MsgBox "Created Zip!"
    
End Sub


 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.