Click here to Skip to main content
15,881,172 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: substr and find of string Pin
George_George4-Sep-08 19:37
George_George4-Sep-08 19:37 
AnswerRe: substr and find of string Pin
markkuk4-Sep-08 11:25
markkuk4-Sep-08 11:25 
GeneralRe: substr and find of string Pin
George_George4-Sep-08 19:40
George_George4-Sep-08 19:40 
QuestionHow to know the availability of COM ports that are attached to our computer programmatically ? Pin
kapardhi3-Sep-08 23:55
kapardhi3-Sep-08 23:55 
AnswerRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
Rane4-Sep-08 0:41
Rane4-Sep-08 0:41 
GeneralRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
kapardhi4-Sep-08 2:10
kapardhi4-Sep-08 2:10 
QuestionRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
David Crow4-Sep-08 3:46
David Crow4-Sep-08 3:46 
AnswerRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
Roger Stoltz4-Sep-08 2:28
Roger Stoltz4-Sep-08 2:28 
I understand your question as "the ports are physically there but how can I know if they are in use", which is quite different from listing the ports present in the system.

I've understood your question correctly, the answer is that you cannot do what you desire, based on simple logic:

In case of real RS232-UARTs the system doesn't know if you have attached something in the other end of a serial device since no communication is done until you open an application and tell it that you want to communicate with a certain port. The user have to keep track of which port he/she has connected the device to.

In case of the port being a virtual COM port such as a USB device, the COM port assigned to the device will not be present in the system until the device is attached. Then you have the same situation as with real COM ports; you use an application that opens the port with ::CreateFile().

Any application can open a port provided that the device name is known and for this you may enumerate the ports present in the system and for which you've already been given an answer.
From the machine's perspective a "free port" in the sense I've interpreted your question does not exist.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


GeneralRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
kapardhi4-Sep-08 2:58
kapardhi4-Sep-08 2:58 
AnswerRe: How to know the availability of COM ports that are attached to our computer programmatically ? Pin
Roger Stoltz4-Sep-08 3:09
Roger Stoltz4-Sep-08 3:09 
QuestionProblem in zooming the image. Pin
Bernaad3-Sep-08 23:24
Bernaad3-Sep-08 23:24 
AnswerRe: Problem in zooming the image. Pin
SandipG 3-Sep-08 23:31
SandipG 3-Sep-08 23:31 
GeneralRe: Problem in zooming the image. Pin
Bernaad3-Sep-08 23:51
Bernaad3-Sep-08 23:51 
GeneralRe: Problem in zooming the image. Pin
SandipG 3-Sep-08 23:55
SandipG 3-Sep-08 23:55 
GeneralRe: Problem in zooming the image. Pin
Bernaad4-Sep-08 0:12
Bernaad4-Sep-08 0:12 
GeneralRe: Problem in zooming the image. Pin
Mark Salsbery4-Sep-08 5:24
Mark Salsbery4-Sep-08 5:24 
Question怎么取得当前使用的计算机的用户名呢 Pin
alphaxz3-Sep-08 23:19
alphaxz3-Sep-08 23:19 
AnswerRe: The correct answer is Pin
Rajesh R Subramanian3-Sep-08 23:20
professionalRajesh R Subramanian3-Sep-08 23:20 
AnswerRe: YOU LOOSER Pin
toxcct3-Sep-08 23:26
toxcct3-Sep-08 23:26 
GeneralRe: YOU LOOSER Pin
alphaxz3-Sep-08 23:43
alphaxz3-Sep-08 23:43 
GeneralRe: YOU LOOSER Pin
SandipG 3-Sep-08 23:46
SandipG 3-Sep-08 23:46 
GeneralRe: YOU LOOSER Pin
ThatsAlok3-Sep-08 23:51
ThatsAlok3-Sep-08 23:51 
GeneralRe: YOU LOOSER Pin
David Crow4-Sep-08 3:49
David Crow4-Sep-08 3:49 
GeneralRe: YOU LOOSER Pin
toxcct4-Sep-08 0:43
toxcct4-Sep-08 0:43 
GeneralRe: YOU LOOSER Pin
Mark Salsbery4-Sep-08 5:25
Mark Salsbery4-Sep-08 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.