USB arrival detector

This is a discussion on USB arrival detector within the C# Programming forums, part of the General Programming Boards category; I'm testing a code that i found on Internet which detects cd-rom arrival. Now i want to change it in ...

  1. #1
    ch4
    ch4 is offline
    Newbeer ch4's Avatar
    Join Date
    Jan 2007
    Posts
    142

    USB arrival detector

    I'm testing a code that i found on Internet which detects cd-rom arrival. Now i want to change it in order to detect removable disk arrival.

    This is the condition but it doesn't work
    Code:
    q.Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 2"

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    What is q?

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    q is a WqlEventQuery Class

    Try changing this:

    Code:
    q.Condition = @"TargetInstance ISA 'Win32_LogicalDisk' and TargetInstance.DriveType = 2"
    to this:

    Code:
    q.Condition = @"TargetInstance ISA 'Win32_USBControllerdevice'";

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Hardware + Software][C++ or C#] USB Fan
    By Mywk in forum C++ Programming
    Replies: 16
    Last Post: 07-04-2009, 04:12 PM
  2. How to detect usb storage arrival and its mount path from C
    By mostafa in forum Linux Programming
    Replies: 9
    Last Post: 10-13-2008, 08:31 PM
  3. Usb 2.0
    By ober in forum Tech Board
    Replies: 6
    Last Post: 09-06-2003, 11:14 AM
  4. usb programming
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-24-2002, 09:06 PM
  5. Printers On USB
    By (TNT) in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-10-2002, 11:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21