#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)
|