Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get a signal when a USB device is added or removed

How to get a signal when a USB device is added or removed

Scheduled Pinned Locked Moved C / C++ / MFC
c++windows-admintutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Luckymmkay
    wrote on last edited by
    #1

    Is there any way to get a signal from the PC to my application when a USB device is added or removed from the PC. I have a USB chip (CP2102 from Silicon Laboratories), and I am currently polling every second and looking to see if it is still in the registry or not. There must be any easier way to detect a USB connection or disconnection in C or C++. Is there anyway to ask Windows to send me a message or an event?

    E 1 Reply Last reply
    0
    • L Luckymmkay

      Is there any way to get a signal from the PC to my application when a USB device is added or removed from the PC. I have a USB chip (CP2102 from Silicon Laboratories), and I am currently polling every second and looking to see if it is still in the registry or not. There must be any easier way to detect a USB connection or disconnection in C or C++. Is there anyway to ask Windows to send me a message or an event?

      E Offline
      E Offline
      earl
      wrote on last edited by
      #2

      1 - RegisterDeviceNotification 2 - you can register a notification callback on changes to registry keys earl

      L 1 Reply Last reply
      0
      • E earl

        1 - RegisterDeviceNotification 2 - you can register a notification callback on changes to registry keys earl

        L Offline
        L Offline
        Luckymmkay
        wrote on last edited by
        #3

        Thank you for pointing me in the right direction. I will try that tonight.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups