PDA

View Full Version : COMM_Open never sets Err



EmbeddedMan
28-09-2015, 17:38
The help says that COMM_Open() will set Err to some value if there is an error detected when opening a com port.

I'm running Windows 7 64 bit, and no matter which com port I try to open, I always see the Err is 0 after COMM_Open(), no matter if the port exists or if it doesn't exists.

Shouldn't there be some way to tell if the COMM_Open() call failed? In other words, if you try to open a non-existent COM port?

No matter what number I have for sComPort, this line of code
COMM_Open("\\.\COM" & sComPort, hComm)

doesn't seem to do anything to the Err value of 0.

Thanks-

*Brian

ErosOlmi
28-09-2015, 21:27
Can you please try the attached updated module?
Just unzip thinBasic_COMM.DLL into your \thinbasic\Lib\ replacing your cuurrent one.

I've updated COMM_OPEN to return a value (error code).
If something goes wrong a value different from ZERO should return

EmbeddedMan
28-09-2015, 21:50
Yes! That works just great. Does the returned error code have any meaning other than "not zero"?

Don't forget to update the help file with this most useful information if you choose to include this new DLL in the next version of TB.

*Brian

ErosOlmi
28-09-2015, 21:56
No, no meaning at the moment.
Just generic error in case of not zero.

Yes, sure: your name will be added as "Thanks To" in the bug fix.