catching a keypress

BlitzPlus Forums/BlitzPlus Beginners Area/catching a keypress

keyboard(Posted 2005) [#1]
if the user presses <print screen> my full-screen game loses focus, and the "print screen" dialogue is displayed. I can disable the dialogue, but I wonder, for other users who play the game, is there a way to disable, or capture the <print screen> keypress so it doesn't get through to windows?

i have tried
if keyhit(183) flushkeys()


that doesn't work... :(


Grey Alien(Posted 2005) [#2]
In my full screen game <print screen> does nothing! In fact I tried to capture the key for my own purposes and that failed too. I am using Blitz PLus 1.4. Are you using Graphics w, h, d to set the full screen or something else? Is the print screen dialog part of Blitz or is it part of another app running in the background?


keyboard(Posted 2005) [#3]
@Grey Alien: the <print screen> dialogue has an option to turn it off - that is, it turns off the notification, it still copies the screen or the open window (alt/prntscrn) to the clipboard. So maybe your print screen dialogue is turned off, if you press <print screen> and then <paste> into a graphics editor, it will probably paste in the screen cap...

just a guess... I'm using win98, I'm assuming that doesn't make much difference...


Grey Alien(Posted 2005) [#4]
HMM, there is no print screen dialog on my PC (Win XP Home). I often use the key in windows and it also works in my game after all! I have never seen a print screen dialog and I used Win98 extensively. The only time I ever saw a dialog was when I had an old version of paint shop pro running to capture screens but then the key combo wasn't even using print screen. The screenshot should just go into the clipboard ready to paste into another app.

You know you disable your dialog, can you reenable it? If so how. This will tell me if it is a standard windows thing or not!


keyboard(Posted 2005) [#5]
@Grey Alien: I don't know how to reenable the dialogue ! I looked on the net, like at annoyances.org, but I couldn't find anything...

But other windows "key combos" like "alt tab" to change focus, I would like to capture those and get rid of them as well.

The thing is - my "GAME", is not really so much of a game, it just generates some coloured balls that bounce around and change when a key is pressed. It is for a friend, who has a little boy, who likes to sit on his lap when he is at the computer. He asked if I could make something so that if the little guy plays with the keyboard, he would not do anything to the system, so I wanted to make a program where the screen never lost focus, except with the quit command...

but I don't know how to stop the system alt/tabbing and stuff...


Grey Alien(Posted 2005) [#6]
I see. The problem with Alt+Tab and Windows key is they are hard to trap. You have to intercept the key presses at low level in the windows messaging queue by adding in your own hooks; this is not easy. Typically it is the sort of thing you would do with C. I am not sure how to achieve the same effect in Blitz Basic. Maybe someone else will know? ... Try a google search?


keyboard(Posted 2005) [#7]
Hmmm

thanks for that

I think i will put a message on the screen saying "don't alt/tab"

:)