comms port re-assignment

A

anbeyon

Does anyone out there know how to go about changing comms port
assigments programatically.

I have an application I am to develop using USB to serial bridges. My
customer want me to make sure my application ALWAYS uses Com1.

The only problem with that is that there could already be a COM1 :0)

Using control panel, system, hardware, device manager, selecting ports,
the comms port to change and then port settings, advanced setting it is
possible to move the comms ports to othe COM values.

Does any one know how I can do this in VB, VB.NET or C# please

Thanks

Anbeyon
 
D

Damien

Does anyone out there know how to go about changing comms port
assigments programatically.

I have an application I am to develop using USB to serial bridges. My
customer want me to make sure my application ALWAYS uses Com1.

The only problem with that is that there could already be a COM1 :0)

What happens when the next application (and the next, and the next...)
comes along that *absolutely has to use COM1*. They provide higher
numbers so that multiple devices can get along nicely on the same
system...

That being said, I do not believe you will find a simple API callable
from .NET Framework. The Framework isn't meant to be the magical, one
size fits all multi tool for all windows programming, and this job
isn't the kind of thing it *was* designed for.

Damien
 
R

r norman

What happens when the next application (and the next, and the next...)
comes along that *absolutely has to use COM1*. They provide higher
numbers so that multiple devices can get along nicely on the same
system...

That being said, I do not believe you will find a simple API callable
from .NET Framework. The Framework isn't meant to be the magical, one
size fits all multi tool for all windows programming, and this job
isn't the kind of thing it *was* designed for.

Customers are often unreasonable and only sometimes can you
accommodate that unreasonableness. This may be one time where you
simply say "you can't do that!".

Who provides the hardware on which the application runs? If the
customer, then all you have to do is tell the customer that (s)he is
the one responsible for making sure that COM1 connects to the proper
device. If it is you, then you can accommodate the request by being
very fussy about the hardware you choose. Of course it might mean
buying more expensive hardware which you must get the customer to pay
for!
 
D

Dick Grier

Hi,

AFAIK, there is no API for this. It requires substantial "fiddling" with
the Windows Registry, and Microsoft has never exposed it.

Such an API would be a nice feature, but... I have no suggestions about how
to implement it in your own code. I suspect that it is possible, but (I
have searched, in for code to do this), have never seen a solution.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
A

anbeyon

Thanks for the replies. Dick I suspect you are correct.

Looks like I will have to coerse my customer into doing something
slightly different.

Anbeyon
 

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

Top