Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB Examples

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

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


VB Strings
VB Byte Array

 

 

 

 

 

 

 

XML Embed Binary File

Demonstrates how to embed a binary file in XML. Also extracts binary data from XML and saves to a file.

Download Chilkat FileAccess ActiveX (freeware)

Download Chilkat XML ActiveX

Dim fileData() As Byte

'  Load a binary file from disk:
Dim fac As New CkFileAccess
fileData = fac.ReadEntireFile("dude.gif")

Dim xml As New ChilkatXml

xml.Tag = "gifData"

'  If set to 1, the binary data is automatically compressed
'  before being added to the XML.  In this example, GIF data
'  is already a compressed file format, so we another layer
'  of compression doesn't really help much...
Dim zipFlag As Long
zipFlag = 0

'  The data may be automatically 128-bit AES encrypted
'  if this flag is set to 1.
Dim encryptFlag As Long
encryptFlag = 0

Dim password As String
password = "NotUsed"

Dim success As Long
success = xml.SetBinaryContent(fileData,zipFlag,encryptFlag,password)

'  Examine the XML.  (The binary content is base64-encoded)
Text1.Text = Text1.Text & xml.GetXml() & vbCrLf

'  Now extract the content to a file:
success = xml.SaveBinaryContent("out.gif",zipFlag,encryptFlag,password)
If (success <> 1) Then
    MsgBox xml.LastErrorText
End If

'  The original data may be saved using the FileAccess component in this way:
Dim facSuccess As Long
facSuccess = fac.WriteEntireFile("original.gif", fileData)
If (facSuccess = 0) Then
    MsgBox fac.LastErrorText
    Exit Sub
End If


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