Reputation: 439
How can I detect the connected devices into a Computer using C++? I can use windows programming facility, but .Net functionality is not allowed.
Thanks in advance.
Upvotes: 0
Views: 2303
Reputation: 283634
The SetupDi* (device manager) APIs can be called from C++.
If you want information about hot-plugged devices, you'll want to combine this with Alex's suggestion of WM_DEVICECHANGE
, which tells you when to call SetupDi* again.
Upvotes: 1
Reputation: 43311
Try to handle WM_DEVICECHANGE message. When wParam = DBT_DEVICEARRIVAL, new device is detected.
Upvotes: 1