#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=IsNotebook.ico
#AutoIt3Wrapper_outfile=IsNotebook.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=台式机/笔记本判断
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=@copyright 2010
#AutoIt3Wrapper_Res_Field=CompanyName|www.ampc8.com
#EndRegion AutoIt3Wrapper 预编译参数(常用参数)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <ProgressConstants.au3>
;若为笔记本则关闭小键盘
$Form1 = GUICreate("台式机/笔记本判断", 250, 150,-1,-1)
FileInstall("1.bmp", @TempDir & "\")
FileInstall("2.bmp", @TempDir & "\")
$Pic = GUICtrlCreatePic(@TempDir & "\1.bmp", 5, 8, 90, 80)
FileInstall("LibGhostHlper.dll", @WindowsDir & "\LibGhostHlper.dll", 1)
$libghosthlperdll = DllOpen(@WindowsDir & "\LibGhostHlper.dll")
$isnotebook = DllCall($libghosthlperdll, "int", "Util_IsNotebook")
If $isnotebook[0] = "0" Then
$NumLock = "你的是台式机"
GUICtrlSetImage($Pic,@TempDir & "\1.bmp")
EndIf
If $isnotebook[0] = "1" Then
GUICtrlSetImage($Pic,@TempDir & "\2.bmp")
$NumLock = "你的是笔记本"
EndIf
$Button1 = GUICtrlCreateButton("开启小键盘", 25, 115, 75, 22, 0)
$Button2 = GUICtrlCreateButton("关闭小键盘", 125, 115, 75, 22, 0)
$Reg = RegRead("HKEY_USERS\.DEFAULT\Control Panel\Keyboard", "InitialKeyboardIndicators")
If StringInStr($Reg,"0") Then
$TXT = "小键盘已开启"
GUICtrlSetState($Button1,$GUI_DISABLE)
EndIf
If StringInStr($Reg,"2") Then
$TXT = "小键盘已关闭"
GUICtrlSetState($Button2,$GUI_DISABLE)
EndIf
$Label = GUICtrlCreateLabel("", 125, 25, 90, 20)
$Labe2 = GUICtrlCreateLabel("", 125, 60, 90, 20)
GUICtrlSetData($Label,$NumLock)
GUICtrlSetData($Labe2,$TXT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
DllClose($libghosthlperdll)
FileDelete(@WindowsDir & "\LibGhostHlper.dll")
FileDelete(@TempDir & "\1.bmp")
FileDelete(@TempDir & "\2.bmp")
Exit
Case $nMsg = $Button1
RegWrite("HKEY_USERS\.DEFAULT\Control Panel\Keyboard", "InitialKeyboardIndicators", "REG_SZ", 0)
Send("{NumLock on}")
_IsNotebook()
GUICtrlSetState($Button1,$GUI_DISABLE)
GUICtrlSetState($Button2,$GUI_ENABLE)
GUICtrlSetData($Labe2,$TXT)
Case $nMsg = $Button2
RegWrite("HKEY_USERS\.DEFAULT\Control Panel\Keyboard", "InitialKeyboardIndicators", "REG_SZ", 2)
Send("{NumLock off}")
_IsNotebook()
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Button1,$GUI_ENABLE)
GUICtrlSetData($Labe2,$TXT)
EndSelect
WEnd
Func _IsNotebook()
DllClose($libghosthlperdll)
$isnotebook = DllCall($libghosthlperdll, "int", "Util_IsNotebook")
$Reg = RegRead("HKEY_USERS\.DEFAULT\Control Panel\Keyboard", "InitialKeyboardIndicators")
If StringInStr($Reg,"0") Then
$TXT = "小键盘已开启"
EndIf
If StringInStr($Reg,"2") Then
$TXT = "小键盘已关闭"
EndIf
EndFunc ;==>_IsNotebook
附件:
|