|
|
| Author |
Message |
DocJC
Joined: 16 Mar 2006
Posts: 90
Location: Cleveland, OH
|
|
Posted: 09 April 2007, 18:17 PM Post subject: VB6 MSCOMM Hack |
|
|
With the addition of the USB to Serial converter available from Don, and others, I suspect more an more people will be implementing USB interfaces instead of classic RS-232 interfaces to PCs.
If one is writing the PC interface in VB6 the following info may be helpful:
On my PC a FTDI USB to Serial converter enumerated itself as Port 22, and I could NOT directly access it with the VB6 MSCOMM control.
Changing the Port from within the Hardware Manager was one work around solution, although the user has to pick a port with a lower number that is not in use, and will not become in use while the current device is using the port.
It turns out that the MSCOMM control only works with ports up through number 16, but the OCX file can be changed to allow it to work with higher port numbers.
Using a hex editor, look for the following 3 byte sequence 3D 10 00 within the file (C:\windows\system32\) MSCOMM32.OCX
The middle byte, 10, (hex) is the upper port limit. Change it to 99 (or whatever), to increase the number of ports the control will utilize.
Save the file and re-boot.
You can now easily, directly, access devices, such as the USB to Serial Module(s), than are enumerated to high port numbers.
Much thanks to Strongm on the tek-tips forum for this insight!
JC |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 09 April 2007, 18:52 PM Post subject: Re: VB6 MSCOMM Hack |
|
|
| DocJC wrote: | | The middle byte, 10, (hex) is the upper port limit. Change it to 99 (or whatever), to increase the number of ports the control will utilize. |
Although it probably doesn't matter much, if you want the highest allowable port number to be 99 the value &H63 should be used. |
|
| Back to top |
|
 |
dlh
Joined: 15 Dec 2006
Posts: 287
Location: ~Cincinnati
|
|
Posted: 18 April 2007, 0:03 AM Post subject: |
|
|
| Apparently, this depends on the version of MSCOMM32.OCX. The version that is on my original VB4-32 CD dated 7/26/95 does not have the 3D 10 00 byte sequence while later [e.g. 6/24/98] versions do. |
|
| Back to top |
|
 |
stevech
Joined: 23 Feb 2006
Posts: 688
|
|
Posted: 18 April 2007, 16:03 PM Post subject: |
|
|
I recall that very old versions had a limit of like 16. But for quite some time it's been 255 or some such. I've used numbers in the 30's. One source for the DLL is somewhere on Maxstream's website
http://maxstream.net/ |
|
| Back to top |
|
 |
|