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#
  4. USB device event

USB device event

Scheduled Pinned Locked Moved C#
csharpjavascriptadobedata-structuresquestion
4 Posts 4 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
    Libor Tinka
    wrote on last edited by
    #1

    Is it possible in C# app to react on some "USB device connected" event (USB Mass Storage, to be more precise) and obtain its new drive letter? I have a directory tree and want to refresh it when new drive appears (e.g. flash disc).

    L A E 3 Replies Last reply
    0
    • L Libor Tinka

      Is it possible in C# app to react on some "USB device connected" event (USB Mass Storage, to be more precise) and obtain its new drive letter? I have a directory tree and want to refresh it when new drive appears (e.g. flash disc).

      L Offline
      L Offline
      Lapje
      wrote on last edited by
      #2

      You should start using unmanaged code then, kernel32.dll I think. You could also use user32.dll to read system messages. Search http://www.pinvoke.net for sample code.

      1 Reply Last reply
      0
      • L Libor Tinka

        Is it possible in C# app to react on some "USB device connected" event (USB Mass Storage, to be more precise) and obtain its new drive letter? I have a directory tree and want to refresh it when new drive appears (e.g. flash disc).

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        since it's a "mass storage device" microsoft has a generic driver for it... that's all I know.

        1 Reply Last reply
        0
        • L Libor Tinka

          Is it possible in C# app to react on some "USB device connected" event (USB Mass Storage, to be more precise) and obtain its new drive letter? I have a directory tree and want to refresh it when new drive appears (e.g. flash disc).

          E Offline
          E Offline
          eggie5
          wrote on last edited by
          #4

          Cbeck out some article on Coding4Fun on MSDN. That should tell you how to do it.

          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