本帖最后由 lixiaolong 于 2012-2-19 14:13 编辑
支持Win7 32位,64位没有测试.
#include <SetupApi.au3>
$Sound_Name = "Conexant SmartAudio HD"; 请在设备管理器中查看自己的设备名称.
Local $hDevs, $tDevInfo, $tDevInfo, $aSound[1][2] = [[0]]
$hDevs = _SetupDiGetClassDevs($DIGCF_PRESENT, "media")
While _SetupDiEnumDeviceInfo($hDevs, $aSound[0][0], $tDevInfo)
$sDescr = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, $SPDRP_DEVICEDESC)
$aSound[$aSound[0][0]][0] = $sDescr
$aSound[$aSound[0][0]][1] = _SetupDiGetDeviceInstanceID($hDevs, $tDevInfo)
If $aSound[$aSound[0][0]][0] == $Sound_Name Then
$fResult = _SetupDiDisableDevice($hDevs, $tDevInfo, True) ; 禁用
If $fResult = True Then
MsgBox(0, "", "声卡禁用成功。")
Else
MsgBox(0, "", "错误码:" & @error)
EndIf
$fResult = _SetupDiDisableDevice($hDevs, $tDevInfo, False) ; 启用
ExitLoop
EndIf
WEnd
(参考pusofalse版主的帖子) |