Results 1 to 22 of 22

Thread: Detect when a USB mass storage device is plugged in.

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Re: Detect when a USB mass storage device is plugged in.

    Can this code or Chris's code be used in a Windows service? I tried creating one in VS2008 and putting the code in there but get alot of errors.

    Thanks

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Detect when a USB mass storage device is plugged in.

    Quote Originally Posted by WarrenW View Post
    Can this code or Chris's code be used in a Windows service? I tried creating one in VS2008 and putting the code in there but get alot of errors.

    Thanks
    I know mine almost certainly cant because it relies on the message that Windows sends to all top level windows when a device is plugged in - and with a Service not having any windows (well, it should have anyway) that means it cannot receive the message.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Question Re: Detect when a USB mass storage device is plugged in.

    Chris,

    I put your code in a winform app in VS2008 and worked great! Is there any way to detect when it is removed/unplugged from the computer? I'm sure it can detect changes but to determine the same drive was removed.

    Thanks!

    Warren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width