界面控件会闪动
#NoTrayIcon
#RequireAdmin
#PRE_UseX64=n
#include <SetupApi.au3>
Opt("GUIOnEventMode", 1);开启事件模式
Opt("GUICloseOnESC", 0);关闭“按ESC”退出脚本的功能
If WinExists("浦发网银付款回单自动截图") Then
Exit
Else
Global $hGui = GUICreate("浦发网银付款回单自动截图", 400, 370)
EndIf
GUICtrlCreateLabel("U-KEY状态:", 52, 290, 72, 12)
Global $uLabel = GUICtrlCreateLabel("", 124, 290, 72, 12)
GUICtrlCreateLabel("网银状态:", 20, 340, 60, 12)
Global $vLabel = GUICtrlCreateLabel("", 80, 340, 72, 12)
GUISetState()
GUISetOnEvent(-3, "_Exit")
AdlibRegister("Timer")
AdlibRegister('_DetectHardID', 50)
While 1
Sleep(10)
WEnd
Func _DetectHardID();检测U-KEY设备实例ID
Local $hDevs, $tDevInfo, $aMouse[1][2] = [[0]]
$hDevs = _SetupDiGetClassDevs($DIGCF_PRESENT, "CDROM");DiskDrive
While _SetupDiEnumDeviceInfo($hDevs, $aMouse[0][0], $tDevInfo)
$aMouse[0][0] += 1
$sDescr = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, $SPDRP_DEVICEDESC)
$sName = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, $SPDRP_FRIENDLYNAME)
If $sName <> "" Then $sDescr = $sName
ReDim $aMouse[$aMouse[0][0] + 1][2]
$aMouse[$aMouse[0][0]][0] = $sDescr ; 磁盘描述信息
$aMouse[$aMouse[0][0]][1] = _SetupDiGetDeviceInstanceId($hDevs, $tDevInfo) ; 设备范例ID
WEnd
; 枚举网卡只需把"DiskDrive"改为"Net",鼠标则对应Mouse,光驱则为CDROM,显卡对应Display。
_SetupDiDestroyDeviceInfoList($hDevs)
Local $dFindDevs = ""
For $i = 1 To $aMouse[0][0]
If StringInStr($aMouse[$i][1], "USBSTOR\CDROM&VEN_TENDYRON&PROD_U-DISK&REV_1.10\") Then;
$dFindDevs = $aMouse[$i][1]
ExitLoop
EndIf
Next
Return $dFindDevs;把变量值返回给函数_DetectHardID()
EndFunc ;==>_DetectHardID
Func Timer()
If _DetectHardID() <> '' Then
GUICtrlSetData($uLabel, "已插入")
Else
GUICtrlSetData($uLabel, "未插入")
EndIf
If WinExists("浦发银行网银客户端") Then
GUICtrlSetData($vLabel, "客户端版")
ElseIf WinExists("上海浦东发展银行公司网上银行 - Internet Explorer") Then
GUICtrlSetData($vLabel, "网页版(IE)")
ElseIf WinExists("上海浦东发展银行公司网上银行 - 用户配置 1 - Microsoft Edge") Then
GUICtrlSetData($vLabel, "网页版(Edge)")
Else
GUICtrlSetData($vLabel, "未登录")
EndIf
EndFunc ;==>Timer
Func _Exit()
Exit
EndFunc ;==>_Exit
|