Mscomm32.ocx Run Time Error

Joined
Aug 17, 2015
Messages
3
Reaction score
0
Hi
I have some old programs, developed in VB6 that use the serial port with mscomm32.ocx
This programs works fine on windows XP, 7, 8, 8.1
After windows 10 installation this happens:
- Program start normally
- When i click a button, the program do this steps:
open the serial port (no errors)
try to read a serial character (no errors)
send a serial character (no errors)
try to read an answered serial character and receive the error:

"run time error 8020" "Error reading comm device"

- I have RE-registered mscomctl.ocx and mscomm32.ocx -> nothing change
- I have RE-installed usb/serial driver -> nothing change

The device work fine using a standard communication utility like "putty".

Any suggestion?

thanks
 
Last edited by a moderator:
Joined
Oct 6, 2015
Messages
2
Reaction score
0
I can reproduce the same problem with the Polou USB Micro Controllers, Open works, Write works but Read fails (8020 ); No problems with the exact same code on Win 7 & Win 8; only win 10.
 
Joined
May 12, 2016
Messages
1
Reaction score
0
Sometimes the easiest answer is the solution. Let me tell at the begining that, I've solved the problem. That is the story:



I have tried lots of things, but when I was talking to a friend about my problem (who knows nothing on computing and VB6), he told me "I used to use a BIOS setting in older PCs, not to halt on any error such as no diskette driver, no keyboard, don't you have a command like that. OK there is an error but don't care about it, don't warn me about it, don't stop even if there are errors".



Yes, what he was talking about is the easy, old, sweety "On Error Resume Next" statement!!!



I hvae used it and my programs started to communicate via MSCOMM32 as they used to.



You should better use "On Error Goto" and "Err.Number" to trap other errors instead of this 8020 error. May be there is a real error, may be the USB to RS232 cable disconnected etc.



And second warning, sometimes On Error Resume Next inludes the subroutines, sometimes it takes a lot of time to understand what is going on (and what is not going on) in your code when you use On Error Resume Next. So, copy your communicating lines to a sub, put an On Error Resume Next at the begining of this sub and call this sub when you need to comminucate devices via MSCOMM32.



I hope this will be helpful...
 
Joined
Oct 6, 2015
Messages
2
Reaction score
0
Your on Error Resume next/go to suggestion does not fix this issue. No matter what you do in your receive code, you will still get no data. You can send, but no data arrives when reading/waiting for data events. This is STILL an outstanding problem. My solution was to move from MSCOMM32 to SComm32.ocx when I run into this MSCOMM32 and some windows 10 comm drivers.
 
Joined
Aug 17, 2015
Messages
3
Reaction score
0
I have found a different solution:
instead of mscomm32.ocx now i use a free software: CommIO.bas
very simple to understand and to use...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top