|
发表于 2015-9-14 15:51:07
|
显示全部楼层
回复 14# gyhhi
代码如下:
#RequireAdmin
#NoTrayIcon
#region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=201.ico
#PRE_Outfile=键盘大小写状态.exe
#PRE_Outfile_x64=键盘大小写.exe
#PRE_Compression=4
#PRE_Res_Comment=键盘大小写
#PRE_Res_Description=键盘大小写功能
#PRE_Res_Fileversion=1.0.0.0
#PRE_Res_LegalCopyright=DIY:chzj589
#PRE_Res_requestedExecutionLevel=None
#PRE_Res_Field=脚本制作|2013-10-24
#PRE_Run_Tidy=y
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#region AutoIt3Wrapper 预编译参数(常用参数)
;#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll|-96
;#AutoIt3Wrapper_UseAnsi=N ;编码
#endregion AutoIt3Wrapper 预编译参数(常用参数)
Opt("GUIOnEventMode", 1)
#include <GUIConstantsEx.au3>
#include <windowsconstants.au3>
Global $Labela, $Label1, $Button1, $Button2, $result, $GForm1
;Global $result = DllCall("user32.dll", "Int", "GetKeyState", "int", 20)
;#cs
GUI()
While 1
Sleep(100)
WEnd
Func GUI()
$GForm1 = GUICreate("大写键盘灯:", @DesktopWidth - 804, @DesktopHeight - 694, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "GForm1Close")
$Label1 = GUICtrlCreateLabel("键盘大小写状态:", 20, 20, 130, 17)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
$Labela = GUICtrlCreateLabel("", 150, 20, 70, 21)
GUICtrlSetFont(-1, 12, 600, 0, "微软雅黑")
;GUICtrlSetColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("", 100, 45, 100, 22)
GUICtrlSetOnEvent($Button1, "g_Button1")
$Button2 = GUICtrlCreateButton("", 100, 45, 100, 22)
GUICtrlSetOnEvent($Button2, "g_Button2")
_result()
GUISetState(@SW_SHOW)
EndFunc ;==>GUI
Func _result()
$result = DllCall("user32.dll", "Int", "GetKeyState", "int", 20)
If @error = 1 Then
MsgBox(0, "错误", "函数调用失败") ;基本上不会的 :)
Exit
Else
If $result[0] = 1 Then
;MsgBox(0,"大写键盘灯","大写键盘灯状态: 亮",10)
GUICtrlSetState($Button1, $GUI_HIDE)
GUICtrlSetState($Button2, $GUI_SHOW)
GUICtrlSetData($Labela, "大写")
GUICtrlSetData($Button2, "键盘状态:大写")
GUICtrlSetColor($Labela, 0x009900)
GUICtrlSetColor($Label1, 0x009900)
Else
;MsgBox(0,"大写键盘灯","大写键盘灯状态: 灭",10)
GUICtrlSetState($Button2, $GUI_HIDE)
GUICtrlSetState($Button1, $GUI_SHOW)
GUICtrlSetData($Labela, "小写")
GUICtrlSetData($Button1, "键盘状态:小写")
GUICtrlSetColor($Labela, 0xFF0000)
GUICtrlSetColor($Label1, 0xFF0000)
EndIf
EndIf
EndFunc ;==>_result
Func g_Button1()
GUISetState(@SW_HIDE, $GForm1)
GUI()
_result()
EndFunc ;==>g_Button1
Func g_Button2()
GUISetState(@SW_HIDE, $GForm1)
GUI()
_result()
EndFunc ;==>g_Button2
Func GForm1Close()
Exit
EndFunc ;==>GForm1Close |
|