Home > Free Stuff > VB6 Code
Visual Basic 6.0 Free Code
Restrictions
You may not redistribute any of the following free code as 'sample' or 'demos'. However,
you are free to use the source code or components in your own code, but you may not claim
that you created any of the sample code or compiled components found on this site.
It is also expressly forbidden to sell or profit from any of the sample code or compiled
components other than by the knowledge gained or the enhanced value added by your own
code. For instance, using one of the encryption routines within a suite of encryption
routines for sale is forbidden, but using an encryption routine to protect passwords in
a business application that is not wholy concerned with encryption is allowed.
If you use any of the source code or compiled components on this site, you realize that
you do so at your own risk. The code and components provided here are supplied as is without
warranty or guarantee of any kind.
Should you wish to commission some derivative work based on the code provided here, or
any consultancy work, please do not hesitate to contact us
This sample Add-In demonstrates how to write an Add-In for Visual Basic 6.0. It provides
some of the functionality you will find in our VBCodeHelper product that can be found
at http://www.vbcodehelper.com.
Rijndael AES Block Cipher (VB Version) rijndaelvb.zip (13KB) (Updated 19-Apr-2001)
The zip file contains two implementations of the Rijndael AES Block Cipher based on the
C code version published by Mike Scott. One is a VB 6.0 Class, the other a VBScript ASP
version, both come with some test code that shows how to use them. Updated 03-Apr-2001
with two new methods and demo code that shows how to encrypt/decrypt strings. Updated
19-Apr-2001 to fix bug with 256 bit keys.
MD5 Digest - VB, VBScript (ASP), and JavaScript versions MD5.zip (17KB)
The zip file contains both VB6 and ASP (VBScript) versions of code for generating an
MD5 'digest' or 'signature' of a string. In addition, a JavaScript version has now been
included thanks to Enrico Mosanghini. The MD5 algorithm is one of the industry standard
methods for generating digital signatures. It is generically known as a digest, digital
signature, one-way encryption, hash or checksum algorithm. A common use for MD5 is for
password encryption as it is one-way in nature, that does not mean that your passwords
are not free from a dictionary attack.
SHA-256 Digest - VB and VBScript (ASP) versions SHA.zip (14KB)
The zip file contains both VB6 and ASP (VBScript) versions of code for generating a
SHA-256 'digest' or 'signature' of a string. The SHA-256 algorithm is one of the industry
standard methods for generating digital signatures. It is generically known as a digest,
digital signature, one-way encryption, hash or checksum algorithm. A common use for SHA-256
is for password encryption as it is one-way in nature, that does not mean that your passwords
are not free from a dictionary attack.
FrezCrypto FrezCrypto.zip (Version 1.2 - 18KB)
FrezCrypto is an ActiveX DLL component that wraps the Microsoft CryptoAPI and provides
the user with methods to encrypt or decrypt strings. The user has the option of Block (RC2)
or Stream (RC4) encryption. The encrypted data can be returned (or supplied for decryption)
either as a string (complete with all manner of control characters) or converted to a hex
format where each character is converted to the hex of its ascii value. The download
contains the DLL, the Visual Basic code for the DLL, and some Visual Basic code that
exercises the methods and shows how it maybe used.
Zlib Wrapper is a Visual Basic module and test harness that wraps the Zlib DLL as
provided at the following web site;
http://www.gzip.org/zlib/. The Zlib library is free
and available for a number of different platforms, it provides
a lossless compression routine and is useful for large strings containing duplicate data
to some extent, for instance XML documents.
String Sort StringSort.zip (Version 1.1 - 5KB)
The string sort routines are contained in a Visual Basic module. The module includes
algorithms for Quick Sort, Merge Sort, Insert Sort and Selection Sort. However, it is
recommended that you use Quick Sort all the time as this 'non-standard' routine delegates
to Insert Sort for small arrays and chunks.
Routines for path manipulation using the shlwapi.dll type library that comes with
Internet Explorer. Comes complete with test harness.
GetRelativePath demonstrates when given a directory path and a file path how to
return the relative path from the directory to the file.
GetCompactPath demonstartes how to compact a long path name down into a small
space in order to display it effectively in, say, a small text box.
An application that will do a smart search of the INTERNIC and NOMINET registrars
for available .COM and .CO.UK domain names. The code could easily be extended to search
other domains.
Create and Validate License Keys Registration.zip (19KB) (Version 2 - 27-May-2001)
The included classes and test form demonstrate three different methods on how you can
generate license keys (such as the CD keys on the case of most Microsoft software) and test
their validity for your applications.
Method 1: A 17 character numeric key. Simple technique, but could be guessed using a brute
force attack.
Method 2: Generates a 25 character alpha-numeric key, the first 9 characters are
completely random, the next 16 are based on an MD5 digest of the first 9 random characters
plus an application specific string. 35,184,372,088,832 different possible keys for an
application, extremely difficult to crack or guess.
Method 3: Generates a 16 character alpha-numeric key based on an MD5 digest of a
supplied registered user name and an application specific string. Generates a key
that is extremely difficult to crack where you know the name of the registered user.
Replacement for VB's SaveSetting and GetSetting RegSettings.zip (3KB)
This module contains two procedures; SaveStringSetting and GetStringSetting. These
procedures can be used as replacements for VB's SaveSetting and GetSetting so that your
data is written to the more useful 'HKEY_LOCAL_MACHINE\SOFTWARE' rather than
the 'HKEY_CURRENT_USER\Software\VB and VBA Program Settings' key.
Custom Message Box - Replacement for VB's MsgBox Function CustomMB.zip (14KB)
This is a replacement for VB's standard MsgBox so that you can have a message box that
is in the same style as the rest of your application (i.e. font size, colour, button
size). It has an identical interface to VB's own MsgBox and so can be easily integrated
into existing applications.
It also allows you to have non-standard message boxes by defining your own captions
for buttons. There is an example that demonstrates displaying errors and including
a 'Copy' button that copies the text to the clipboard so the user can paste the message
into an email or document.