请教监视U盘的那段代码
以前论坛见到过,现在却不见了.有朋友收藏的吗?共享一下.[ 本帖最后由 itljl 于 2008-8-4 16:54 编辑 ] http://www.autoitx.com/forum.php?mod=viewthread&tid=462&highlight=U%C5%CC 不是这个。。。 http://runningwaterpro.blog.163.com/blog/static/311948120086274460170
主要功能有了。 <P><A href="http://hi.baidu.com/iokey/blog/item/11def344fb1e1087b2b7dc57.html" target=_blank>http://hi.baidu.com/iokey/blog/item/11def344fb1e1087b2b7dc57.html</A></P>
<P> </P>
<P> </P>
<P>$strComputer = "."<BR>$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")</P>
<P>$colEvents = $objWMIService.ExecNotificationQuery _<BR>("Select * From __InstanceOperationEvent Within 5 Where " _<BR>& "TargetInstance isa 'Win32_LogicalDisk'")</P>
<P>While 1<BR>$objEvent = $colEvents.NextEvent<BR>If $objEvent.TargetInstance.DriveType = 2 Then <BR>Select <BR>Case $objEvent.Path_.Class()="__InstanceCreationEvent"<BR>Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been added." & @CR)<BR>Case $objEvent.Path_.Class()="__InstanceDeletionEvent"<BR>Consolewrite("Drive " & $objEvent.TargetInstance.DeviceId & "has been removed."& @CR)<BR>EndSelect<BR>EndIf<BR>WEnd</P>
<P> </P>
[ 本帖最后由 gooker 于 2008-7-28 09:41 编辑 ] 糊涂中,,,,,,,,,,
页:
[1]