Re: Problem with MSComm port
CommPort is usually something like COM1, COM14, etc...
Its a bit blurry, but it looks like your Arduino may be COM40, so I assume you should try that.
Re: Problem with MSComm port
The MSComm32.ocx has a validity check on the CommPort property that limits it to values between 1 and 16.
It is possible to perform a binary hack on the OCX to change the upper limit to as high as at least 99, but this isn't supported. I've done it in the past and it worked fine for my application.
The stock OCX should have a sequence of bytes 3D 10 00 that is unique in most versions. The 10 is of course 16, and this byte can be altered to a larger value to permit the use of COM17: and up. I'm not sure stuffing FF in there would be successful up to COM255: but you can certainly put in 63 to get a range from COM1: through COM99: if you need to.
Re: Problem with MSComm port
I didn't remember the MSComm32.ocx limit of 16 ports, but then I don't usually let the port numbers get that high.
If I plug in a USB to serial device and I see the com ports assigned higher com ports than I want, then there are two options.
One is in Win7 you can usually change the port number the ports are mapped to by selecting the properties of the comport and selecting a lower unused port number.
But you also may want to unallocate some port numbers that have been reserved from prior insertions of the serial devices in different USB ports.
You can follow a procedure like the one describe here, https://learn.adafruit.com/how-to-fi...ports/overview to show the hidden ports, and remove them.
Then when you reconnect your device you should get assignments in a much lower range. Try to always use the same USB port for a given Serial device so it will reuse the same port numbers, and not assign it new port numbers because you plugged it into a different USB port.
Re: Problem with MSComm port
I agree that for such applications that would be a far better solution.
People seem to have no clue that jamming devices into random USB ports over and over creates so much crud as Plug and Play struggles to keep up with the insanity. USB ports are not wall sockets but expansion ports just like ISA, PCI, and other bus slots.