#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIEx.au3>
#Include <Constants.au3>
#NoTrayIcon
$mainwindow=GUICreate("窗体透明", 189, 32, @DesktopWidth-350, @DesktopHeight-72, BitOR($WS_POPUP,$WS_CLIPSIBLINGS),BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST),WinGetHandle('[Class:Shell_TrayWnd]'))
$Label = GUICtrlCreateLabel("标签", 0, 0, 189, 32,$SS_BLACKFRAME,$GUI_WS_EX_PARENTDRAG)
$Pic = GUICtrlCreatePic("tu.jpg", 0, 0, 189, 32)
$Contextmenu = GUICtrlCreateContextMenu (3)
$infoitem = GUICtrlCreateMenuitem ("退出",$contextmenu)
;数字锁定键检测
If _WinAPI_GetKeyState(0x90) Then
GUICtrlCreatePic("on.gif",13,10,12,12)
Else
GUICtrlCreatePic("off.gif",13,10,12,12)
EndIf
;大小写锁定键检测
If _WinAPI_GetKeyState(0x14) Then
GUICtrlCreatePic("on.gif",70,10,12,12)
Else
GUICtrlCreatePic("off.gif",70,10,12,12)
EndIf
;滚动锁定键检测
If _WinAPI_GetKeyState(0x91) Then
GUICtrlCreatePic("on.gif",128,10,12,12)
Else
GUICtrlCreatePic("off.gif",128,10,12,12)
EndIf
GUISetState(@SW_SHOWNA)
While 1
$NumLock = _WinAPI_GetKeyState(0x90)
$CapsLock = _WinAPI_GetKeyState(0x14)
$ScrollLOCK = _WinAPI_GetKeyState(0x91)
HotKeySet("{NUMLOCK}", "SNUMLOCK")
HotKeySet("{CAPSLOCK}", "SCAPSLOCK")
HotKeySet("{SCROLLLOCK}","SSCROLLLOCK")
$nMsg = GUIGetMsg()
Switch $nMsg
Case $infoitem
Exit
EndSwitch
WEnd
Func SNUMLOCK() ;数字锁定键检测
If $NumLock Then
GUICtrlCreatePic("on.gif",13,10,12,12)
Else
GUICtrlCreatePic("off.gif",13,10,12,12)
EndIf
EndFunc
Func SCAPSLOCK() ;大小写锁定键检测
If $CapsLock Then
GUICtrlCreatePic("on.gif",70,10,12,12)
Else
GUICtrlCreatePic("off.gif",70,10,12,12)
EndIf
EndFunc
Func SSCROLLLOCK() ;滚动锁定键检测
If $ScrollLOCK Then
GUICtrlCreatePic("on.gif",128,10,12,12)
Else
GUICtrlCreatePic("off.gif",128,10,12,12)
EndIf
EndFunc