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. Other Discussions
  3. IT & Infrastructure
  4. usb detection

usb detection

Scheduled Pinned Locked Moved IT & Infrastructure
question
3 Posts 2 Posters 2 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.
  • G Offline
    G Offline
    groovy dude
    wrote on last edited by
    #1

    does anybody know if there is a way to capture the Windows XP event of a USB mouse being plugged in or unplugged? I currently support a large school division, and we are going to be buying a large amount of computers with USB mice(Currently mice go missing on a regular basis). I want to be able to write some code that will log to a text file the time that that the usb mouse gets unplugged, does anybody know if this information can be pulled from XP( I am assumin ghtere is a way, as it makes a sound when I unplug the mouse), and using what coding language. Thanks Tech Coordinator

    G 1 Reply Last reply
    0
    • G groovy dude

      does anybody know if there is a way to capture the Windows XP event of a USB mouse being plugged in or unplugged? I currently support a large school division, and we are going to be buying a large amount of computers with USB mice(Currently mice go missing on a regular basis). I want to be able to write some code that will log to a text file the time that that the usb mouse gets unplugged, does anybody know if this information can be pulled from XP( I am assumin ghtere is a way, as it makes a sound when I unplug the mouse), and using what coding language. Thanks Tech Coordinator

      G Offline
      G Offline
      gdocherty
      wrote on last edited by
      #2

      Hi, You can use DirectInput and the EnumDevices method (with visual c++) to tell you how many mouses are connected to the PC. Perhaps in a background program which checks them every now and then.

      G 1 Reply Last reply
      0
      • G gdocherty

        Hi, You can use DirectInput and the EnumDevices method (with visual c++) to tell you how many mouses are connected to the PC. Perhaps in a background program which checks them every now and then.

        G Offline
        G Offline
        groovy dude
        wrote on last edited by
        #3

        Thanks, I have found a way to identify if there is a USB mouse plugged in using a simple VBscript with Microsoft's WMI. Running a query of the pointing devices gives me the information if a USB mouse is plugged in or not. I am pretty sure if I run a service in the background it will work, but I am thinking that it will be hard on resources. I would really like to be able to trigger my script on the event of any USB device being plugged in or unplugged. Are there any WMI guru's out there?

        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