Hello,

I am working with rs232, and i have to write program in visual c++ which reads continous data from rs232.
For that first i need to open available com ports from pc.
I have COM3 in my pc, but i have to write com3 manually in my program.
Is there any way, something like system call in visual c++ MFC, which can detect automatically
com port, and then can open it.

Thanks.

Hello,

I am working with rs232, and i have to write program in visual c++ which reads continous data from rs232.
For that first i need to open available com ports from pc.
I have COM3 in my pc, but i have to write com3 manually in my program.
Is there any way, something like system call in visual c++ MFC, which can detect automatically
com port, and then can open it.

Thanks.

The last time I worked on COM ports was 1997. It was using Windows 98, so I'll do my best from memory.

As far as locating, you'll need to write some code that will go through and query each COM port. Or, if you are familiar with registry classes, the hardware part of the registry might contain the active com ports.

And, who knows, TAPI may already know about which ports are installed.

Please forgive my title. I originally thought your post had to do with detecting an incoming read.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.