I have code that tests for the existance of any com ports :
For idx = 1 To 255 Step 1
sComNum="COM" + Trim(Str(idx),Any Chr(32)) ' Convert idx to string and trim off leading and trailing spaces (32)
sComInit=sComNum+proto
Open Com (sComInit) For Random As chan + 1
' state = err
If Err=0 Then
Print "Found port "; sComNum
Else
Goto nextport
End If
chan += 1
portname(chan) = sComNum
nextport:
Print "Trying next port "; idx
Next idx
This used to work until I upgraded to the latest version (I was quite a way behind) ... Now it is OK if the port exists but aborts the program if it does not exist and never reaches the test on Err.
COM1 exists but COM2 doesn't so it never scans further than 2 and there are several up around 10.
Has something changed or am I missing something fundamental ?
Puzzled,
Dave
Detecting com ports ?
Re: Detecting com ports ?
OK Fixed it.
The later version of the compiler GUI I am using has -exx specified. Adding "On Error Goto nextport" solved it.
Dave
The later version of the compiler GUI I am using has -exx specified. Adding "On Error Goto nextport" solved it.
Dave