itljl 发表于 2008-7-26 23:21:43

请教监视U盘的那段代码

以前论坛见到过,现在却不见了.有朋友收藏的吗?共享一下.

[ 本帖最后由 itljl 于 2008-8-4 16:54 编辑 ]

qop1830 发表于 2008-7-27 06:36:00

http://www.autoitx.com/forum.php?mod=viewthread&tid=462&highlight=U%C5%CC

itljl 发表于 2008-7-28 01:07:06

不是这个。。。

runningwater 发表于 2008-7-28 08:35:02

http://runningwaterpro.blog.163.com/blog/static/311948120086274460170
主要功能有了。

gooker 发表于 2008-7-28 09:40:32

<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>&nbsp;</P>
<P>&nbsp;</P>
<P>$strComputer = "."<BR>$objWMIService = ObjGet("winmgmts:\\" &amp; $strComputer &amp; "\root\cimv2")</P>
<P>$colEvents = $objWMIService.ExecNotificationQuery _<BR>("Select * From __InstanceOperationEvent Within 5 Where " _<BR>&amp; "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 " &amp; $objEvent.TargetInstance.DeviceId &amp; "has been added." &amp; @CR)<BR>Case $objEvent.Path_.Class()="__InstanceDeletionEvent"<BR>Consolewrite("Drive " &amp; $objEvent.TargetInstance.DeviceId &amp; "has been removed."&amp; @CR)<BR>EndSelect<BR>EndIf<BR>WEnd</P>
<P>&nbsp;</P>

[ 本帖最后由 gooker 于 2008-7-28 09:41 编辑 ]

lvchuang 发表于 2014-5-7 03:48:24

糊涂中,,,,,,,,,,
页: [1]
查看完整版本: 请教监视U盘的那段代码