qq4045728 发表于 2011-10-23 12:13:57

求一个智能判断台式机与笔记本数字键盘灯开/关闭的AU3代码

求一个智能判断台式机与笔记本数字键盘灯开/关闭的AU3代码   NumLock

lixiaolong 发表于 2011-10-23 16:42:04

本帖最后由 lixiaolong 于 2011-10-23 16:44 编辑

回复 1# qq4045728

函 数 参 考
_WinAPI_GetKeyState
--------------------------------------------------------------------------------
检索指定虚拟键的状态.
_WinAPI_GetKeyState ( $vKey )

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_LegalCopyright=http://www.autoitx.com/ - lixiaolong
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WinAPIEx.au3>

Global Const $VK_NUMLOCK = 0x90

While 1
        $msg = GUIGetMsg()
        _AlwaysNumLockON($VK_NUMLOCK)
WEnd

Func _AlwaysNumLockON($Key)
        Local $State = _WinAPI_GetKeyState($Key); Check NumLock ON,OFF
        If Not $State Then Send('{NUMLOCK ON}'); If Not $State Then = 如果数字键盘(NumLock)灯没开.
EndFunc   ;==>_AlwaysNumLockON

xms77 发表于 2011-10-23 20:52:32

李小龙还是很厉害的说,Kongfu不知道,au3可以的

gzh888666 发表于 2011-10-24 08:20:51

本帖最后由 gzh888666 于 2011-10-24 08:28 编辑

回复qq4045728

函 数 参 考
_WinAPI_GetKeyState
--------------------------------------------- ...
lixiaolong 发表于 2011-10-23 16:42 http://www.autoitx.com/images/common/back.gif

最新版的AU3帮助里怎么搜不到_WinAPI_GetKeyState了?WinAPIExCHS.chm不更新了吗?

虫子樱桃 发表于 2011-10-24 12:42:10

通过wmi检查计算机类型$strComputer = "."

$objWMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $strComputer & "\root\cimv2")
$colChassis = $objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
For $objChassis in $colChassis
For $strChassisType in $objChassis.ChassisTypes


if $strChassisType = 8 or $strChassisType = 9 or $strChassisType = 10 then msgbox(0, "", "laptop")
if $strChassisType = 3 or $strChassisType = 4 or $strChassisType = 5 or $strChassisType = 6 or $strChassisType = 7 then msgbox(0, "", "Desktop")

Next
next

lixiaolong 发表于 2011-10-24 14:14:28

本帖最后由 lixiaolong 于 2011-10-24 14:20 编辑

回复 4# gzh888666

我看的UDF 版本是 3.0.

这个是最新的UDF 版本是 3.5.
http://www.autoitx.com/forum.php?mod=viewthread&tid=7404&highlight=WinAPIEx

Virtual-Key Codes (Windows):
http://msdn.microsoft.com/en-us/library/dd375731(v=VS.85).aspx

ylsfwb 发表于 2011-10-24 14:52:26

学习学习班    !!!!

yangysky 发表于 2011-10-27 01:53:50

谢谢,学习了!
页: [1]
查看完整版本: 求一个智能判断台式机与笔记本数字键盘灯开/关闭的AU3代码