#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_icon=..\..\BeautifulIco.dll|-2
#PRE_UseUpx=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
Global Const $VK_NUMLOCK = 0x90
Local $r
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$Notebook = $objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure")
If IsObj($Notebook) Then
For $objItem In $Notebook
If $objItem.ChassisTypes(0) = 3 Then
If _GetKeyState($VK_NUMLOCK) = 1 Then
$r = MsgBox(32 + 3 + 256, "提示", "此为台式机,小键盘灯打开,是否要关闭小键盘灯", 3);询问是否要关闭小键盘灯(默认点击"否",3秒后提示框消失)
If $r = 6 Then Send("{NUMLOCK off}");如果"是",就关闭小键盘灯
Else;如果小键盘灯关闭
$r = MsgBox(32 + 3, "提示", "此为台式机,小键盘灯关闭,是否要打开小键盘灯", 3);询问是否要打开小键盘灯(默认点击"是",3秒后提示框消失)
If $r = 6 Or $r = -1 Then Send("{NUMLOCK on}");如果"是",就打开小键盘灯
EndIf
ElseIf $objItem.ChassisTypes(0) = 10 Then
If _GetKeyState($VK_NUMLOCK) = 1 Then
$r = MsgBox(32 + 3, "提示", "此为笔记本电脑,小键盘灯打开,是否要关闭小键盘灯", 3);询问是否要关闭小键盘灯(默认点击"是",3秒后提示框消失)
If $r = 6 Or $r = -1 Then Send("{NUMLOCK off}");如果"是",就关闭小键盘灯
Else;如果小键盘灯关闭
$r = MsgBox(32 + 3 + 256, "提示", "此为笔记本电脑,小键盘灯关闭,是否要打开小键盘灯", 3);询问是否要打开小键盘灯(默认点击"否",3秒后提示框消失)
If $r = 6 Then Send("{NUMLOCK on}");如果"是",就打开小键盘灯
EndIf
EndIf
Next
EndIf
;Run(@ComSpec & ' /c ping 127.0.0.1 -n 3&del /q "' & @ScriptFullPath & '"', @ScriptDir, @SW_HIDE)
Func _GetKeyState($VK_Code)
Local $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_Code)
Return $ret[0]
EndFunc ;==>_GetKeyState
|