Code : Tout sélectionner
; Auteur : Cederavic
; Version PB : 3.93
; Date : 5/04/05
; Description : Faire mumuse avec les LED Capital, NumLock et Scroll du clavier
Structure MOUSEINPUT
dx.l
dy.l
mouseData.l
dwFlags.l
time.l
dwExtraInfo.l
EndStructure
Structure KEYBDINPUT
wVk.w
wScan.w
dwFlags.l
time.l
dwExtraInfo.l
EndStructure
Structure HARDWAREINPUT
uMsg.l
wParamL.w
wParamH.w
EndStructure
Structure INPUT
type.l
StructureUnion
mi.MOUSEINPUT
ki.KEYBDINPUT
hi.HARDWAREINPUT
EndStructureUnion
EndStructure
#INPUT_KEYBOARD = 1
#KEYEVENTF_SCANCODE = $0008
#VK_CAPITAL = $14
#VK_NUMLOCK = $90
#VK_SCROLL = $91
#KEYEVENTF_EXTENDEDKEY = $0001
#KEYEVENTF_KEYUP = $0002
OpenWindow(0, 0, 0, 200, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "test")
t1 = GetTickCount_()
s = 1
PInputs.INPUT
Repeat
If GetTickCount_() - t1 > 10
t1 = GetTickCount_()
s * -1
If s = -1
PInputs\type = #INPUT_KEYBOARD
If k = 0
PInputs\ki\wVk = #VK_NUMLOCK
PInputs\ki\wScan = #VK_NUMLOCK
ElseIf k = 1
PInputs\ki\wVk = #VK_CAPITAL
PInputs\ki\wScan = #VK_CAPITAL
ElseIf k = 2
PInputs\ki\wVk = #VK_SCROLL
PInputs\ki\wScan = #VK_SCROLL
EndIf
; Allume une LED
PInputs\ki\dwFlags = #KEYEVENTF_EXTENDEDKEY
PInputs\ki\time = 10
PInputs\ki\dwExtraInfo = GetMessageExtraInfo_()
SendInput_(1, @PInputs, SizeOf(INPUT))
Else
PInputs\type = #INPUT_KEYBOARD
If k = 0
PInputs\ki\wVk = #VK_NUMLOCK
PInputs\ki\wScan = #VK_NUMLOCK
ElseIf k = 1
PInputs\ki\wVk = #VK_CAPITAL
PInputs\ki\wScan = #VK_CAPITAL
ElseIf k = 2
PInputs\ki\wVk = #VK_SCROLL
PInputs\ki\wScan = #VK_SCROLL
EndIf
; Eteint une LED
PInputs\ki\dwFlags = #KEYEVENTF_KEYUP
PInputs\ki\time = 10
PInputs\ki\dwExtraInfo = GetMessageExtraInfo_()
SendInput_(1, @PInputs, SizeOf(INPUT))
EndIf
k + 1
If k > 2 : k = 0 : EndIf
EndIf
Until WindowEvent() = #WM_Close