Disabling+'sticky+key'+action+of+Shift

//by Richard Russell, October 2008//

By default, pressing the **Shift** key five times activates the Windows **StickyKeys** accessibility feature. Whilst this can be useful for people with certain disabilities, it can be irritating if you use BBC BASIC's [|VDU 14] //paged mode//, in which scrolling is paused until the Shift key is pressed.

Although you can disable StickyKeys in Windows Control Panel, it may not be convenient to do so, and it isn't very user-friendly. A better approach may be to disable the specific action of the Shift key using the code below:

code format="bb4w" SPI_GETSTICKYKEYS = 58 SPI_SETSTICKYKEYS = 59 SKF_HOTKEYACTIVE = 4 DIM sk{cbSize%, dwFlags%} sk.cbSize% = DIM(sk{}) SYS "SystemParametersInfo", SPI_GETSTICKYKEYS, DIM(sk{}), sk{}, 0 sk.dwFlags% AND= NOT SKF_HOTKEYACTIVE SYS "SystemParametersInfo", SPI_SETSTICKYKEYS, DIM(sk{}), sk{}, 0 code This will disable the Sticky Key action of the Shift key for the remainder of the session. You can make the change permanent by altering the final parameter from **0** to **1**, but you probably won't want to do that.

If you prefer, you can restore the previous setting before your program exits as follows:

code format="bb4w" SPI_GETSTICKYKEYS = 58 SPI_SETSTICKYKEYS = 59 SKF_HOTKEYACTIVE = 4 DIM sk{cbSize%, dwFlags%} sk.cbSize% = DIM(sk{}) SYS "SystemParametersInfo", SPI_GETSTICKYKEYS, DIM(sk{}), sk{}, 0 OldStickyFlags% = sk.dwFlags%

sk.dwFlags% AND= NOT SKF_HOTKEYACTIVE SYS "SystemParametersInfo", SPI_SETSTICKYKEYS, DIM(sk{}), sk{}, 0

REM. Your program does its stuff here

sk.dwFlags% = OldStickyFlags% SYS "SystemParametersInfo", SPI_SETSTICKYKEYS, DIM(sk{}), sk{}, 0 code