找回密码
 加入
搜索
查看: 2275|回复: 5

请教监视U盘的那段代码

[复制链接]
发表于 2008-7-26 23:21:43 | 显示全部楼层 |阅读模式
以前论坛见到过,现在却不见了.有朋友收藏的吗?共享一下.

[ 本帖最后由 itljl 于 2008-8-4 16:54 编辑 ]
发表于 2008-7-27 06:36:00 | 显示全部楼层
 楼主| 发表于 2008-7-28 01:07:06 | 显示全部楼层
不是这个。。。
发表于 2008-7-28 08:35:02 | 显示全部楼层
发表于 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 编辑 ]
发表于 2014-5-7 03:48:24 | 显示全部楼层
糊涂中,,,,,,,,,,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 22:26 , Processed in 0.067666 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表