找回密码
 加入
搜索
查看: 2664|回复: 8

[AU3基础] (已解决)求一个函数名 : 在设备管理器里搜寻给定的硬件名字,或者说根据字母搜寻

  [复制链接]
发表于 2010-6-29 17:21:26 | 显示全部楼层 |阅读模式
本帖最后由 yarsye 于 2010-7-27 16:12 编辑

在设备管理器里搜寻给定的硬件名字,或者说根据字母搜寻硬件名字 然后进行操作 , disable/enable/install /uninstall......
发表于 2010-6-29 18:36:08 | 显示全部楼层
#include <SetupAPI.au3>

_CM_Get_Device_ID_By_Name_Ex ; Obtain the device instance identifier.
_SetupDiDisableDevice ; Disable/enable a device.
_SetupDiRemoveDevice ; Uninstall
_CM_Scan_Device_Changes ; Scan for hardware changes (Install).
 楼主| 发表于 2010-6-29 20:07:18 | 显示全部楼层
回复 2# pusofalse


    奥 找到你写的函数了
真是位牛人 不知道到达你的境界还得走多远的路
 楼主| 发表于 2010-6-29 20:36:20 | 显示全部楼层
#include

_CM_Get_Device_ID_By_Name_Ex ; Obtain the device instance identifier.
_SetupDiDisableD ...
pusofalse 发表于 2010-6-29 18:36

我好想自己解决下面问题,但是我试了多次没成功,就想来问你了
有几个想问下
1.
_CM_Get_Device_ID_By_Name_Ex("Imaging devices", $fMatchAll = True, $sDeviceID = "", $hMachine = 0)
这样好像不行?已经指定了device name了啊
2.
WARNING: $fMatchAll: possibly used before declaration.
我调用你的每个函数都说没定义 ,我需要加什么?还是我哪个地方错了?
3._SetupDiDisableDevice($hDevs, $pSP_DEVINFO_DATA, $fDisable = True)
这个函数参数第一个是句柄对吧,第二个需要填什么?
发表于 2010-6-29 20:57:21 | 显示全部楼层
#include <SetupApi.au3>

Local $sDeviceId, $hDevs, $tDevInfo

$sDeviceId = _CM_Get_Device_ID_By_Name_Ex("HID-compliant mouse")
If ($sDeviceId = "") Then Exit

; Obtain a handle to device information set.
_SetupDiCreateDeviceDevs($sDeviceId, $hDevs, $tDevInfo)

; The following 4 calls always returns True if succeeds without an error.
; _SetupDiDisableDevice($hDevs, $tDevInfo, 1)        ; Disable
; _SetupDiDisableDevice($hDevs, $tDevInfo, 0)        ; Enable
; _SetupDiRemoveDevice($hDevs, $tDevInfo, 1)        ; Forcibly remove this device
; _CM_Scan_Device_Changes("")        ; Detect the device that has been removed from your system.

; Release handle and vars.
_SetupDiDestroyDeviceInfoList($hDevs)
_SetupDiApiBufferFree($tDevInfo)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2010-6-29 21:06:34 | 显示全部楼层
首先感谢您的回复 谢谢
然后我慢慢研究下 看下还有那个地方不懂的
您可以洗洗澡 准备看球赛了
 楼主| 发表于 2010-6-29 21:27:06 | 显示全部楼层
回复 5# pusofalse


    奥 懂了 你的这几个函数

只需给他一个名字HID-compliant mouse 剩下的就全部可以自己找到
我刚开始给他Imaging devices 还一直在换system devices 现在明白了我错在哪了
 楼主| 发表于 2010-6-29 21:37:24 | 显示全部楼层
_SetupDiDisableDevice($hDevs, $pSP_DEVINFO_DATA, $fDisable = True)
$pSP_DEVINFO_DATA - A pointer to a SP_DEVINFO_DATA structure contains the device information element to be disabled
被这个迷住了
发表于 2017-1-13 10:40:43 | 显示全部楼层
学习了学习了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-19 15:11 , Processed in 0.079676 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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