|
我也来一个,源码公开
Function FF_WINMAIN(ByVal hInstance As HINSTANCE) As Long '程序入口函数
Dim a As SYSTEM_POWER_STATUS
GetSystemPowerStatus(@a)
if a.BatteryFlag = 128 Or a.BatteryFlag = 255 Then
'是台式机,打开键灯
SetLight(VK_NUMLOCK ,True )
Else
'是笔记本,关闭键盘灯
SetLight(VK_NUMLOCK ,False)
End if
Function = True
End Function
Sub SetLight(i as Long ,bState As BOOL)
Dim keyState(256) As UByte
GetKeyboardState(@keyState(0))
if ((bState And Not (keyState(i) And 1)) Or (Not bState And (keyState(i) And 1))) Then
keybd_event(i ,&H45 ,KEYEVENTF_EXTENDEDKEY Or 0 ,0)
keybd_event(i ,&H45 ,KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP ,0)
End if
End Sub
欢迎在PE下测试,该程序为32位EXE
小键盘灯.7z
(10.51 KB, 下载次数: 38)
|
|