CRC-32 Class Module

This Visual Basic 6.0 class module calculates a simple CRC-32 (CCITT-32), four byte Cyclic Redundancy Check. It is commonly used to validate data to determine to a high degree of probability that it has not been corrupted.  For another implementation of CRC-32 (PKZip compatible) and other useful code examples, use this link to Pino Carafa's homepage.

The CRC illustrated here uses an array of type Byte, but could be ported to use a String without too much effort.

Download CRC-32.ZIP (about 3K bytes). 

 

CRC-16 Class Module

This Visual Basic 6.0 class module calculates a simple CRC-16 (CCITT-1021), two byte Cyclic Redundancy Check. It is commonly used to validate data to determine to a reasonable degree of probability that it has not been corrupted.  XMODEM/CRC uses this algorithm (see XMCommCRC.ocx for an actual implementation of XMODEM that uses this algorithm).

The CRC illustrated here uses an array of type Byte, but could be ported to use a String without too much effort.

Download CRC-16.ZIP (about 2K bytes)

 

CRC Note:  You may want to consider the MicroDexterity Stamina library.  I has a number of CRC variations that may meet your needs, if the two above VB modules do not.  Stamina is a professional library of very fast, assembly language routines that contains hundreds of functions.  I recommend it highly.  Go to www.microdexterity.com for information.

 

mComm Class Module

This Visual Basic 6.0 class module demonstrates using MSComm in a class module, without having to include a form to host the MSComm control.  The class module implements most relevant MSComm properties.  Refer to the MSComm documentation in Help for information and syntax.  However, mComm provides the property InputData in place of the MSComm Input property (Input was a reserved word in VB (prior to VB.NET), and cannot be used to name a procedure).

Limitation:  There are licensing issues with MSComm.  Also, you will have to add MSComm32.ocx manually to any distribution package (such as the Package and Distribution Wizard);  Since MSComm is not hosted on a form, it will not be included automatically by the setup program.  See my book, Visual Basic Programmer's Guide to Serial Communications for more information on mComm issues.

Download mComm.Zip (about 3K bytes).

Return to Hard & Software