Re: Reading the Serial Port (OnComm Event)

From: Dick Grier (dick_grierNOSPAM_at_msn.com)
Date: 07/06/04


Date: Tue, 6 Jul 2004 09:23:47 -0600

Hi,

>>
Could this be because my application is using the C++ DLL to open the Comm
port. Therefore I cannot called the PortOpen method on the MSCommCtrl ?
<<

You cannot open a port with MSComm that is still open using the DLL. You
will get an error if you attempt to do so. I assume that the reason that
you don't see this is because you have error trapping disabled (On Error
Resume Next, somewhere).

There is no way to use the comport handle that is obtained by the DLL.
MSComm32.ocx (unlike earlier versions) does not support this. If you have
to use the C++ DLL, then you must either use it for everything, which should
be possible(?), or you can write your own API code that CAN use the handle.

What is it that you are trying to do with MSComm? Just monitor send and
receive? If so, you need a special driver -- there is nothing provided by
Microsoft to help you out. I include several tools for monitoring in my
book. These range from using MSComm on a separate serial port, connected in
parallel with the active port, to device-driver driven (3rd party)
utilities.

***

-- 
Richard Grier  (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.