Keypress that will always be read by program wether it has focus or not?
Keypress that will always be read by program wether it has focus or not?
Is there any way to get a key or combination of keys to always be recognised by a running program whether the running program is the one last clicked with the mouse or not? That is, it may not have the system's focus.
Re: Keypress that will always be read by program wether it has focus or not?
like a keylogger you mean?
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{History Viewer Online}.:|:.{Send a Beer}
Re: Keypress that will always be read by program wether it has focus or not?
I have never heard the term, but searched and it is a horrible thing. I had a third party Android keyboard app once, and I happened to press shift and something by accident, and every single thing I typed on that phone in the previous months was pasted to the document I was in at the time. I guessed that that was how some people harvest passwords etc.
I suppose a keylogger would use the same procedure, but I just want one key or combination to definitely be recognised by a window, that I suspect not all users will remember to click before following the on screen instructions, as it is a stickywindow, it will always be on top and may not be obvious that it isn't active.
Re: Keypress that will always be read by program wether it has focus or not?
windows only you can do it like this
Code: Select all
If Bool(GetAsyncKeyState_(#VK_SHIFT) And GetAsyncKeyState_(#VK_S))
Debug "shift + S "
EndIf
Re: Keypress that will always be read by program wether it has focus or not?
How about using a global hotkey (also Windows-only).
Re: Keypress that will always be read by program wether it has focus or not?
I think you would need to set a window callback for that to work as it doesn't come through the pb event loop
Re: Keypress that will always be read by program wether it has focus or not?
You're correct, in fact one of my main PB projects has a massive WndProc bound with SetWindowCallback mostly for hotkeys like this.
Re: Keypress that will always be read by program wether it has focus or not?
Another term is macro recorder.
Re: Keypress that will always be read by program wether it has focus or not?
At least on windows you can use a keyboard hook when RegisterHotkey_() failed.
I once made a small example years ago:
LowLevelKeyboardHook.pb
I once made a small example years ago:
LowLevelKeyboardHook.pb
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: Keypress that will always be read by program wether it has focus or not?
Thanks for all of the suggestions, I went with the last eample from Axolotl on their link and it works great with VK's.Axolotl wrote: Fri Aug 30, 2024 10:30 am At least on windows you can use a keyboard hook when RegisterHotkey_() failed.
I once made a small example years ago:
LowLevelKeyboardHook.pb


