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 Self-Extracting EXE in Visual Basic

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

This VB Example program shows how to do create Self-Extracting EXEs in Visual Basic. It shows how to create four types of self-extracting executables: (1) a Simple Self-Extracting EXE, (2) an AES Encrypted Self-Extracting EXE, (3) an Auto-Run Self-Extracting EXE, and (4) an Auto-Run AES Encrypted Self-Extracting EXE.

' Create a Simple Self-Extracting EXE
Private Sub Command1_Click()
    Dim zip As ChilkatZip2
    Set zip = New ChilkatZip2
    zip.UnlockComponent "UnlockCode"
    zip.NewZip "notUsed.zip"
    zip.AppendFiles "Sample/*", 1
    success = zip.WriteExe("sample.exe")
    If (success = 0) Then
        MsgBox zip.LastErrorText
        zip.SaveLastError "log.xml"
    Else
        MsgBox "SFX created!"
    End If
End Sub

' Create an AES Encrypted Self-Extracting EXE
Private Sub Command2_Click()
    Dim zip As ChilkatZip2
    Set zip = New ChilkatZip2
    zip.UnlockComponent "UnlockCode"
    zip.NewZip "notUsed.zip"
    zip.AppendFiles "Sample/*", 1
    ' Setting encryption to non-zero causes Rijndael AES encryption to
    ' be used in the self-extracting EXE.
    zip.Encryption = 1
    ' Key lengths can be 128, 192, or 256
    zip.EncryptKeyLength = 256
    zip.SetPassword "chilkat"
    success = zip.WriteExe("encrypted.exe")
    If (success = 0) Then
        MsgBox zip.LastErrorText
        zip.SaveLastError "log.xml"
    Else
        MsgBox "SFX created!"
    End If
End Sub

' Create an Auto-Run Self-Extracting EXE
Private Sub Command3_Click()
    Dim zip As ChilkatZip2
    Set zip = New ChilkatZip2
    zip.UnlockComponent "UnlockCode"
    
    ' AutoTemp and AutoRun control what kind of self-extracting EXE
    ' is created.  If AutoRun is set, the EXE will automatically
    ' run the specified EXE after unzipping.  If AutoTemp is 1
    ' the self-extracted EXE will automatically unzip to a TEMP
    ' directory when double-clicked.
    zip.AutoTemp = 1
    zip.AutoRun = "Sample\Setup.exe"
    
    zip.NewZip "notUsed.zip"
    zip.AppendFiles "Sample/*", 1
    success = zip.WriteExe("autoRun.exe")
    If (success = 0) Then
        MsgBox zip.LastErrorText
        zip.SaveLastError "log.xml"
    Else
        MsgBox "SFX created!"
    End If
End Sub

' Create an Auto-Run AES Encrypted Self-Extracting EXE
Private Sub Command4_Click()
    Dim zip As ChilkatZip2
    Set zip = New ChilkatZip2
    zip.UnlockComponent "UnlockCode"
    
    ' AutoTemp and AutoRun control what kind of self-extracting EXE
    ' is created.  If AutoRun is set, the EXE will automatically
    ' run the specified EXE after unzipping.  If AutoTemp is 1
    ' the self-extracted EXE will automatically unzip to a TEMP
    ' directory when double-clicked.
    zip.AutoTemp = 1
    zip.AutoRun = "Sample\Setup.exe"
    
    zip.NewZip "notUsed.zip"
    zip.AppendFiles "Sample/*", 1
    ' Setting encryption to non-zero causes Rijndael AES encryption to
    ' be used in the self-extracting EXE.
    zip.Encryption = 1
    ' Key lengths can be 128, 192, or 256
    zip.EncryptKeyLength = 256
    zip.SetPassword "chilkat"
    success = zip.WriteExe("encryptedAutoRun.exe")
    If (success = 0) Then
        MsgBox zip.LastErrorText
        zip.SaveLastError "log.xml"
    Else
        MsgBox "SFX created!"
    End If
End Sub


 

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

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