HighTechTalks DotNet Forums  

WMI Event in Vista

Dotnet Framework (WMI) microsoft.public.dotnet.framework.wmi


Discuss WMI Event in Vista in the Dotnet Framework (WMI) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
msnews.microsoft.com
 
Posts: n/a

Default WMI Event in Vista - 12-14-2007 , 05:04 AM






Hi,

i'm Trying to detect USB-Changes under Vista 32bit. This is the Code:

Imports System.management
Public Class Form1
Inherits System.Windows.Forms.Form
....
Dim query As WqlEventQuery
Dim WithEvents watch As ManagementEventWatcher
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
query = New WqlEventQuery("Select * from Win32_DeviceChangeEvent")
watch = New ManagementEventWatcher(query)
watch.Start()
End Sub

Private Sub w_EventArrived(ByVal sender As Object, ByVal e As
System.Management.EventArrivedEventArgs) Handles watch.EventArrived
MsgBox("Event!")
End Sub
End Class


Under XP it works great, but in Vista two threads are close when starting
the EventWatcher.
even with administrator privilegs it won't work.

Can you please help me?

-Stefan



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.