Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
Bzip2
PPMD
Deflate
LZW


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Create an In-Memory Zip File

Download Chilkat Zip ActiveX (includes objects for .zip, .gz, .bz2, and .Z)

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-2010 Chilkat Software, Inc. All Rights Reserved.