jp26198926
New member
hello guys..
i am trying to detect the plug/unplug of usb flashdrive using WMI
but i get an error message "Not Supported";
here is my code:
the error is on the line with red text
that code works fine on my workpace machine with vista OS
but here in home im using xp sp3 which the code not working.
thnx in advance.
i am trying to detect the plug/unplug of usb flashdrive using WMI
but i get an error message "Not Supported";
here is my code:
VB.NET:
Imports System.Management
Public Class Form1
Private WithEvents m_MediaConnectWatcher As New ManagementEventWatcher
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim query2 As New WqlEventQuery("SELECT * FROM __InstanceOperationEvent WITHIN 1 " _
& "WHERE TargetInstance ISA 'Win32_DiskDrive'")
m_MediaConnectWatcher = New ManagementEventWatcher
m_MediaConnectWatcher.Query = query2
m_MediaConnectWatcher.Options.Timeout = New TimeSpan(1000)
[COLOR=red]m_MediaConnectWatcher.Start()[/COLOR]
End Sub
End Class
that code works fine on my workpace machine with vista OS
but here in home im using xp sp3 which the code not working.
thnx in advance.