Block Intrusive keys (ALT+TAB, WINkey, etc.)

Blitz3D Forums/Blitz3D Userlibs/Block Intrusive keys (ALT+TAB, WINkey, etc.)

BlackJumper(Posted 2005) [#1]
I have posted an update to my StickyKeys_dll to the Code Arcs. I created it to deal with the problem of Accessibility features in Windows that can intrude on a game that uses the Shift key (in particular) or the NUM Lock key. There were a number of requests on the BlitzBasic B3D board asking for ways to disable other intrusions such as accidentally hitting the Windows (Start) key or crashes caused by users ALT+TABbing within a game. The update includes this functionality.

1. Can toggle the Accessibility features (FilterKeys, StickyKeys, ToggleKeys) on and off
2. Can independently toggle ToggleKeys on/off
3. Can enable/disable SysKey combinations {Alt+TAB, Alt+Esc, Ctrl+Esc, LeftWIN key, RightWIN key} through simple toggle to restrict task switching from within game
4. Can toggle audible feedback for blocked SysKeys
5. Simple toggle to allow/deny any keyboard intrusions (put outside start + end of your game loop)

N.B. there is presently no Ctr+Alt+Delete blocking functionality

There have been a few tests by the community and it all seems to be working nicely. :-)

Check the Code Arc entry for StickyKey_dll

Hope this isn't seen as 'spamming' (I announced this on the thread requesting the new functions) ... but threads drop out of sight quickly on the B3D Programming forum and this is technically a UserLib.

big10p(Posted 2005) [#2]
I can't seem to get this to work on my win98SE machine.

I want to block all intrusions to my fullscreen app but using Alt+tab is still taking me back to the desktop.

I tested using your supplied code:

Running this code also completely disabled/unloaded StickyKeys so the shortcut no longer worked (even after exiting the program) and the StickyKeys checkbox in Control Panel became unchecked.

Any ideas for us poor win98 users? :)

BlackJumper(Posted 2005) [#3]
@ big10p:

Thanks for reporting your issues with W98SE. The dll should work on W98, but I am willing to take your results on faith over the documentation from M$.

I have the option of including some W98/ME specific code that uses the 'ScreenSaver mode' to disable task-switching... I will try to include this in the next version if I can get reliable reporting of the OS version.

As for the StickyKeys problem... I am not sure why this isn't working. Can you check for the file "StickyKey.txt" on your machine ? {Probably in same folder as the dll.}

If this file exists and is not hidden, then the dll had a problem exiting. Running again should restore the previous settings.

If the file exists and is hidden then it thinks it closed down correctly.

You might try deleting all references to "StickyKey.txt", resetting your Control panel, then try running again to see if the file is being changed during program running.

Please let me know how you get on with this...

big10p(Posted 2005) [#4]
Thanks for replying, BlackJumper.

OK, I looked in the userlibs folder and the stickykeys.txt file was there, not hidden.

Funny thing is, I deleted the file and ran the above code again. It still didn't prevent Alt+tab working but, on exit, the stickykeys.txt file did not reappear in the userlibs folder - hidden or otherwise.

I didn't bother turning on stickykeys in control panel as I just wanted to see if I could get Alt+tab to be blocked.

Have you (or any other user) tested this dll on win98? If so, I'm not sure what's wrong with my machine. :)

BlackJumper(Posted 2005) [#5]

I have emailed you a new build of the dll that (hopefully) detects W95/W98/WME versions and uses the ScreenSaver mode to disable Alt+TAB and Ctr+Alt+Del, etc.

Can you give it a whirl and let me know if it works for you... if so I will make this an official release to satisfy the teeming hordes of Blitzers who have W98 machines that require this functionality ;-)

BlackJumper(Posted 2005) [#6]
Latest info for W98 machines...

big10p has tried my newest build of StickyKeys.dll on a W98SE machine and it does not appear to be working for task-switching. (I believe that StickyKeys, Toggle|Keys and FilterKeys are working though.)

I will be dusting off an old laptop with W98 installed when I get some time and trying to fix this. This is not likely to happen until early November at the earliest. I will also try to incorporate other feature requests at that point.

In the meantime, W98 and W95 (lol) are not fully supported by this userlib. Apologies for any inconvenience.

Barton(Posted 2005) [#7]

STRG+ALT+ENTF isn't blocked :(

and !! ...
If DirectInput=1 then blitz3d ignoring your KeyBlocks.

BlackJumper(Posted 2005) [#8]
@ Barton:

STRG+ALT+ENTF isn't blocked :(

... OK, I got myself an ALT key, but I have no idea what those others are. If you can supply details then I can block them in the next version.

If DirectInput=1 then blitz3d ignoring your KeyBlocks.

... Good to know - could explain the rare problems people have had with this. I will try to include a check for this condition in the next version and maybe give the option of disabling it or at least reporting back on the reason for failure.

Thanks for the input!

JoshK(Posted 2005) [#9]
Why would you want to block the Alt key? Professional games don't do this, because you need to be able to switch out of full-screen mode.

BlackJumper(Posted 2005) [#10]
Well, apart from a probable 'block everything' approach required for W98, I will be giving the option of which features to turn on and off.

Some people might be writing kiosk-style apps that they don't want people to be able to switch out of. There was also some discussion of 'kiddie-proofing' an environment so you could happily leave a toddler bashing away on the keyboard without fear of losing your system.

I know King Dave originally asked for this as a result of problems caused by Freeworld players getting MAVs or lockups.

Barton(Posted 2005) [#11]

if one plays a game, one shall switch nothing over. Just B3D then often falls away. (Memory Access Error)

Grey Alien(Posted 2005) [#12]
I think I said before in an email, but I'll say it on the forum, the "block all" is really good for little kids software, my 1.8 year old loves a slideshow app where space progresses, but Windows Key or anything else doesn't bomb him out.

John Blackledge(Posted 2005) [#13]
"Professional games don't do this, because you need to be able to switch out of full-screen mode"

FYI, I've had graphics cards where if you did this (in any app) it crashed the gfx card. So its good that its the author's choice.