找回密码
 加入
搜索
查看: 2966|回复: 7

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

  [复制链接]
发表于 2011-10-23 12:13:57 | 显示全部楼层 |阅读模式
求一个智能判断台式机与笔记本数字键盘灯开/关闭的AU3代码     NumLock
发表于 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

评分

参与人数 2金钱 +10 贡献 +2 收起 理由
xms77 + 10 学的不错,知道的真多
lynfr8 + 2

查看全部评分

发表于 2011-10-23 20:52:32 | 显示全部楼层
李小龙还是很厉害的说,Kongfu不知道,au3可以的
发表于 2011-10-24 08:20:51 | 显示全部楼层
本帖最后由 gzh888666 于 2011-10-24 08:28 编辑
回复  qq4045728

函 数 参 考
_WinAPI_GetKeyState
--------------------------------------------- ...
lixiaolong 发表于 2011-10-23 16:42


最新版的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

评分

参与人数 1金钱 +10 收起 理由
lixiaolong + 10 这个应该发在源码区~

查看全部评分

发表于 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 ... ;highlight=WinAPIEx

Virtual-Key Codes (Windows):
http://msdn.microsoft.com/en-us/library/dd375731(v=VS.85).aspx
发表于 2011-10-24 14:52:26 | 显示全部楼层
学习学习班    !!!!
发表于 2011-10-27 01:53:50 | 显示全部楼层
谢谢,学习了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 22:25 , Processed in 0.081311 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表