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, "微软雅黑")
$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
GUICtrlSetState($button1, $gui_hide)
GUICtrlSetState($button2, $gui_show)
GUICtrlSetData($labela, "大写")
GUICtrlSetData($button2, "键盘状态:大写")
GUICtrlSetColor($labela, 39168)
GUICtrlSetColor($label1, 39168)
Else
GUICtrlSetState($button2, $gui_hide)
GUICtrlSetState($button1, $gui_show)
GUICtrlSetData($labela, "小写")
GUICtrlSetData($button1, "键盘状态:小写")
GUICtrlSetColor($labela, 16711680)
GUICtrlSetColor($label1, 16711680)
EndIf
EndIf
EndFunc ;==>_result