
mscomm1.commEvent read locks the mouse
Hello,
I am using the mscomm control in VB 5.0, and I found out that a
read of the commEvent property causes the mouse to lock up, although
things continue to work normally.
I traced through the code and made sure the comm port's values were
set (19200,n,8,1), and that it was open. I use 3 of the 4 comm ports on
my system (2 via dll's, one for mscomm, and the fourth is a serial
mouse.)
I stepped through the code, and found out that the mouse locks when
I step through the statement that reads the comm event type. I read it
(setting an integer variable to it) as the first thing in my OnComm
event (sub MSComm1_OnComm). At that point, the mouse locks, though the
system keeps running (I can even continue to step through the code using
the keyboard.)
The comm event is 2, or comEvReceive. My comm port is comm 1, and
I have set RThreshold to 1 in my initialization function. Actually,
something even more bizarre is happening. I created a new variable just
before the commEvent property read, and set it to mscomm1.PortOpen to
confirm that the port was open. When I stepped over that one, it
locked.
I am at a loss, and don't know what to do. Are there any known
problems with setting RThreshold to anything but zero? What if you
don't read a buffer? I am still investigating whether one of my dll's
is wrongly accessing either this mscomm's port (1) or the mouse's port
(3), but I doubt it.
Any ideas will be greatly appreciated.