Code: Select all
;The FILTERKEYS structure contains information about the FilterKeys accessibility feature,
;which allows to set the keyboard repeat rate (RepeatKeys),
;acceptance delay (SlowKeys), and bounce rate (BounceKeys).
LF.S=Chr(10)
#FKF_FILTERKEYSON = 1 ;FILTERKEYS is currently on.
#FKF_AVAILABLE = 2 ;the FILTERKEYS accessibility feature is available.
Structure FilterKeys
cbSize.L
dwFlags.L
iWaitMSec.L ; length of time, in milliseconds, the user must hold down a key before it is accepted.
iDelayMSec.L ; length of time, in milliseconds, the user must hold down a key before it begins To Repeat.
iRepeatMSec.L ;length of time, in milliseconds, between each repetition of a key.
iBounceMSec.L ; length of time, in milliseconds, before subsequent presses of the same key will be accepted.
EndStructure
Procedure GetFilterKeys(*FK.FilterKeys)
*FK\cbSize=SizeOf(FilterKeys)
SystemParametersInfo_(#SPI_GETFILTERKEYS,SizeOf(FilterKeys), *FK, 0);
EndProcedure
Procedure RestoreFilterKeys(*FK.FilterKeys)
*FK\cbSize=SizeOf(FilterKeys)
SystemParametersInfo_(#SPI_SETFILTERKEYS,SizeOf(FilterKeys), *FK, 0);
EndProcedure
Procedure KBnoRepeat()
FK.FilterKeys
FK\cbSize=SizeOf(FilterKeys)
FK\dwFlags= #FKF_FILTERKEYSON | #FKF_AVAILABLE
SystemParametersInfo_(#SPI_SETFILTERKEYS,SizeOf(FilterKeys), @FK, 0);
EndProcedure
Procedure KillFilterKeys()
FK.FilterKeys
FK\cbSize=SizeOf(FilterKeys)
FK\dwFlags= 0
SystemParametersInfo_(#SPI_SETFILTERKEYS,SizeOf(FilterKeys), @FK, 0);
EndProcedure
Orig.FilterKeys
GetFilterKeys(@Orig)
; With Orig
; T$=Str(\cbSize)+LF
; T$+Str(\dwFlags)+LF
; T$+Str(\ iWaitMSec)+LF
; T$+Str(\iDelayMSec)+LF ; at least one of iDelay or iBounce must be 0
; T$+Str(\iRepeatMSec)+LF
; T$+Str(\ iBounceMSec)+LF
; EndWith
; MessageRequester("FilterKeys state",T$,0)
KBnoRepeat()
;
hwnd=OpenWindow(0, 100, 100,600,400 ,"Keyboard Repeat Rate Disabled - Restored on exit", #WS_OVERLAPPEDWINDOW )
_ImGad=EditorGadget(-1,100,100,200,200)
Repeat
EV=WaitWindowEvent()
_MX=WindowMouseX(0)
_MY=WindowMouseY(0)
_MK=Abs(GetAsyncKeyState_(#VK_LBUTTON) +GetAsyncKeyState_(#VK_RBUTTON)*2+GetAsyncKeyState_(#VK_MBUTTON)*3)/$8000
If _MK=2
KillFilterKeys() ; in case the repeat rate is disabled
;RestoreFilterKeys(@Orig.FilterKeys) ;Restore original FilterKeys State
End
EndIf
Until EV= #PB_Event_CloseWindow
KillFilterKeys()