470,850 Members | 1,312 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,850 developers. It's quick & easy.

How to check "Is any device attached to COM port"?

Hi all,
I'm new to this community,so i think i shall introduce myself first, I'm a developer in VC++ 6.0 for past few years,

Now my mission to post this thread is

how can i find "Is any device is attached to the COM (Serial) port of my system using VC++/C++ ?

Regardless of any device is connected to serial/COM port, the port can be opened using CFile, if no other programme has locked the port.
But i need to find Is any device is connected or not?

hope i haven't confused you.

Expecting help asap,as i'm stuck with this bottleneck for quite few hours,
Thanks in advance
Aug 1 '06 #1
1 4117
9,065 Expert Mod 8TB
I don't believe this is possible. The most basic type of device only implements ground, Tx and Rx so you have no electrical signal to tell you if a device is connected. You could look for data but not all devices send unsolicited data so you would need to know a way of getting any device to return data to you.

So detecting any device is impossible.

Detecting specific devices is possible though, for instance you could detect any modem using the Hayes command set by sending AT, all Hayes command set modems will reposnd to this with OK.
Aug 1 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Stinky Pete | last post: by
5 posts views Thread by Matthew Zhou | last post: by
4 posts views Thread by robinp.la | last post: by
94 posts views Thread by Samuel R. Neff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.