Control Hardware

hi every user
I want to control hardware port in C++ .
For more explain: program first detect and identify all hardware in computer system then check this step :

1. if user use usb port show massage (usb port use)
2. if useruse hdmi port show massage (Hdmi port use)
3. if user use DVI port show massage (DVI port usse)
4. if user use HDMI port show massage (HDMI port use)
and etc

can any one help me for programming this problem (C++,Console program)?
Thank
Last edited on
this is not going to be pure c++ (you can USE c++). It is going to take asking the operating system using library calls to get this information. You should be able to find a sample of this for your OS online.

And, if I had a usb or other massager attached to my pc, I would not talk about it in public ;)
Last edited on
Thank you dear jonnin .
Jonnin's right, but I thought I'd point out that USB has a very different interface from the video ports, and they have little or nothing to do with each other.

For that collection of ports you have a winding road through OS interface code. This isn't going to be straight forward or simple, though certainly no more than intermediate programming.

Yet, the word control in your question implies that you want to do something TO those ports, while your list suggests you merely want to sense if those ports are in use.

Very different goals.

Then, of course, the very first thing that must be dealt with is which operating system. Everything about this is very different for Windows than for Mac, or Linux.

I want to use Windows operation (7 up to 10). I want write this program only for controling hardware port . I am beginner programer. I dont know this program is hight level program (I 'm very sorry for this ) . Thank you ( Niccolo and jonnin) . I must very study for c++ .
Have a good time
Last edited on
Accessing I/O ports in Windows is tricky, and it depends on what you are planning to do and with which port on how you code it.

I recommend a library.
https://www.google.com/search?q=win32+access+hardware+port+c


Frankly, though, it is starting to sound to me like you are planning something unkosher. What exactly are you trying to do?
Send my plan to pv with topic (Feed back for you answer)
Topic archived. No new replies allowed.