XMComm Information Page

Return to Hard & Software | Download XMCommCRC (about 2.2 MB) | Download VB6 Example

Download Windows Vista/Win7 (includes x64 installer) - Right-click Setup and select "Run as Administrator"

 Download Latest OCX with example code -- you must re-register the OCX (about 30 KB)  (use this for update only -- use the full install above first! see Note1, below)


The XM in XMComm stands for XMODEM.

I wrote the XMCommCRC ActiveX™ control using Microsoft® Visual Basic™ 6. It wraps the MSComm32.ocx that is furnished VB6 Professional and Enterprise Editions.  The most recent version adds several features.  Only a single version is now provided.  I had previously provided a special version (XMCommVBA) for Access and Excel -- that no longer is needed.

Features that XMComm has that are not available in MSComm32.ocx:


I wanted to make MSComm features available to non-VB5/VB6 Professional or Enterprise edition users. I also wanted to write an ActiveX control that was fairly simple, but which illustrated the essential features of ActiveX creation to include in the Second Edition of my book, Visual Basic Programmer's Guide to Serial Communications 5 published September 2014.  Source code for XMComm is included with the book, and there is a complete description of the code in Chapter 6.


Please refer to the VB5/6 documentation for the MSComm ActiveX control. I will not repeat that here (you can get a detailed description of MSComm properties and events from articles on www.msdn.microsoft.com; better yet, purchase a copy of my book). XMComm provides all essential properties, methods, and events provided by MSComm. There is one exception to this, due to an idiosyncrasy of ActiveX controls that are written in Visual Basic. I could not provide a control property named "Input", as is used in MSComm. Rather, I selected the property name "InputData". This property is used the same way as would be the MSComm Input property. For example,

Dim Buffer As String

Buffer = MSComm1.Input

Buffer = XMComm1.InputData

One question that I often field is, "What speed does MSComm support?" The XMComm control, like MSComm32.ocx that comes with VB5 or later supports speeds up to 115200 bps. If you use either with a modem, make sure that you use a speed that is actually supported by the modem's serial port. These speeds are: 300, 1200, 2400, 9600, 19200, 38400, 57600, and 115200 bps. Do not attempt to use a speed like 28800 or 33600 bps. While the modem may connect at this speed, it CANNOT set its serial port to this speed. Instead, select a higher speed than the actual connect speed. 57600 or 115200 bps usually are best. Enable modem error correction and data compression, of course.

New Properties that are available at design-time and run-time

DisplayStatus - Boolean Enable the XMODEM file transfer progress bar. If DisplayStatus is set to False, the file transfer status dialog is not displayed.  New with Version 2 and later, your code should set the XMComm .Visible property to True or False, depending on the value used for DisplayStatus, before and after file transfers.  For example,

If XMComm1.DisplayStatus = True Then XMComm1.Visible = True

XMComm1.SendFile                    'or XMComm1.ReceiveFile, as needed

XMComm1.Visible = False

The reasons for this change are two-fold.  1st, VBA based environments do not support the a VB ActiveX control's Extender object, which was used internally to automatically perform the above logic.  2nd, VB.NET beta 2 has a bu that is quite unforgiving;  any control that uses the Extender object causes a crash.  For that reason, I decided to no longer use in in XMComm.  Thus, a small amount of additional code is needed externally.

EnableXferCancelButton - Boolean Enable the Cancel command button when DisplayStatus is True. If EnableXferCancelButton is set to False, the command button is not displayed.

MaxErrorCount - Integer The maximum number of retries for that will be allowed before a file transfer is automatically aborted. The default is 10. This is sufficient for most applications.

PackCharacter - Integer XMODEM file transfers use 128 byte, fixed-length, packets. Therefore, if a file that is to be transferred is not an exact multiple of 128 bytes, additional "pack characters" are added to the final packet to pad its length to 128 bytes. The default character is CTRLZ (equal to 26). You may want to select an alternate character, such as a null (equal to 0).

PacketTimeout - Single This value defines the time - in seconds - that will be allowed by the receiving system to receive a complete data packet from the transmitting system. The default PacketTimeout is 1 (1000 mS). This is satisfactory for higher speed connections (say, in excess of 9600 bps), but may need to be increased for slower speed connections. The original XMODEM specification set this value at 10 seconds. However, overall performance is improved somewhat if the PacketTimeout is set to a smaller value when practical.

UseCRC - Boolean  A new property in Version 2.0 and later.  Set to True to support XMODEM/CRC file transfers.  False (default), uses XMODEM/checksum file transfers.

New Properties that are available only at run-time

BytesTransfered - Long This value indicates the number of bytes that have been satisfactorily transferred.

ReceiveFilename - String Set this property to the COMPLETE path, including the filename, of the file that is to be received.

ReceiveFileSize - Long You may use this (optional) property to specify the size of the file to be received. Usually, the file size is not known. However, if specified, the file transfer progress status display will be somewhat more informative.

SendFilename - String Set this property to the COMPLETE path, including the filename, of the file that is to be sent.

TransferStatus - Integer You may read this property at anytime during a file transfer to determine the current transfer status. Here are the values that XMComm uses:

XMComm Event Constants


WAITING = 0 'Transfer not yet started
TRANSFER_STARTED = 100 'Transfer in process
PACKET_SENT = 200 'Packet sent
PACKET_RECEIVED = 300 'Packet received
NO_START = -100 'File transfer not able to start. No signal from other computer.
NO_FILENAME = -200 'No filename selected to receive.
CANCELLED = -300 'CANcel received
ERROR_COUNT_EXCEEDED = -400 'Transfer failed. Retry count = 20
FILENAME_NOT_FOUND = -500 'Send file does not exist
TRANSFER_SUCCEEDED = 1000 'Transfer succeeded!"

(CommEvents - See the MSComm documentation for a full description)



New Methods that are available at run-time

CancelTransfer - Programmatically cancel a transfer that is in progress.

ReceiveFile - Start the receive file transfer process.

SendFile - Start the send file transfer process.

New Event that is available at run-time

TransferStatusChange - Signals a change in file transfer status. This event can be used with the TransferStatus property to notify the user of file transfer progress, or for any logging that may be needed.

Here is a good example that shows how one might use XMComm in an Excel application for laboratory instrumentation: http://www.msc-lims.com/lims/diybalance.html.

Note:  The XMCommCRC.ocx Setup program uses InstallShield.  There is a file named Setup.pdf that is part of the InstallShield setup program.  This is not an Adobe Acrobat file, so don't be upset if you cannot view it.  I am sorry about the unfortunate naming convention used here, but I have no control over it.


This ActiveX control is provided free, without warranty of any kind. You are free to use it for any purpose that you deem reasonable, but the author is not responsible for any such use (or misuse), or for any damage that might result from its use. Treat this software like you would any beta software. It may work as described, but if it does not, you got what you paid for.

The OCX displays a Copyright popup when the program instantiates it.  This may be removed by making a one-line change in the source code for the OCX.  OK, how do you get it without the popup?  Any reader of my book may request a copy of both the source code and/or the dll without the popup.  Send me email to request this.  Alternately, you can purchase the OCX or dll without the popup from me for US$10.  To do this, use PayPal; my PayPal ID is hardandsoftware@comcast.net.  You also may use the button below to purchase.

(This button may not work under Internet Explore -- it does work under Firefox!  My PayPal ID is hardandoftware@comcast.net, if you want to send me a purchase manually)

Feel free to contact me if you have problems. However, I cannot guarantee that I will be able to respond in a timely way. Please let me know about any successes.

Note:  XMCommCRC.ocx is not binary compatible with earlier versions of XMComm.  If you use this control with any existing project, remove XMComm from the Toolbox, and add XMComm/CRC.  The control default name also has changed.

Note1.  If using the latest XMComm (dated 5/5/2009), you must remove any older versions of XMComm, and add the newest version to the Toolbox.  The 5/5/2009 version includes serial port enumeration (Ports() method) and descriptions (PortDescription() method).

Return to Hard & Software