Nickolodeon
Nickolodeon

Reputation: 2956

WMI instrinsic events. Resources

I subscribe to usb inserted event like this

select * FROM __INSTANCECREATIONEVENT WITHIN 3 WHERE TARGETINSTANCE ISA Win32_DiskDrive

After inserting usb flash it blinks every 3 seconds. This is polling interval and intrinsic events work by polling object that's in query. Now, we know these types of events may be resource expensive. (Putting value greater then 3 sometimes chokes these events and client program doesn't get notified).

Are there other ways to do that, so that usb doesn't get scanned all the time? May be there some extrinsic events available?

Right now the only solution I see is to unsubscribe from event above once it trigerred and resubscribe to it in __INSTANCEDELETIONEVENT handler. Hm, althought deletionevent will also poll diskdrive controllers(

Upvotes: 0

Views: 195

Answers (1)

Tergiver
Tergiver

Reputation: 14507

Another mechanism for device notification is RegisterDeviceNotification which you can read about here: http://msdn.microsoft.com/en-us/library/aa363432.aspx

Upvotes: 1

Related Questions