Grabbing keypresses
BlitzPlus Forums/BlitzPlus Programming/Grabbing keypresses
| ||
Is there a way to grab keypresses *even* when the current B+ app is not in focus (not active)? ie. If I click on the desktop (or another program), my B+ app will no longer receive keyboard or mouse related events - and I need it to. :) |
| ||
My initial impression is that you would need to use SetWindowsHookEx (from user32.dll) to set a Windows hook, monitoring mouse messages... Of course SetWindowsHookEx requires a callback function, which means that Blitz would need support for function pointers... which it doesn't. So I think the answer is no, unless you write your own (or use somebody else's) DLL written in another language for this purpose. Can anybody confirm? |
| ||
One way is to keep the Blitz Plus window active by using activategadget in your main loop. When you click on your desktop or any area outside the Blitz Window, the focus immediately returns to the Blitz window so you'll be able to check for the keyboard & mouse. Is this what you wanted? Regards |
| ||
No, I tried that and it doesn't work. Plus, even if it did, it would keep stealing the focus, stopping any other app working properly... I think ;) |
| ||
Any luck since? |
| ||
No, afraid not. Luckily it was something required at the very beginning of a new idea I had, so I didn't lose any time. It's a shame, 'cos it was a good idea too. ;) |