dr34m3rs
asked on
Perl keyboard hook or trap for out of focus key strokes
I want to write a program in PERL that will be able to detect my keyboard input even if my perl consol window is out of focus. I am creating an implied prompt program so depending on the window in focus I can run scripts based on my key combinations, keywords, and the title text of the window. Sort of a "hidden prompt" that will be very useful to me.
1) I need to be able to get the title bar text of the window in focus.
2) I need to be able to "trap" or "hook" the keyboard input.
I want to use Win32::GUI or maybe Win32::API to get the title text. Just need the code to get the title text of the window in focus by the system.
1) I need to be able to get the title bar text of the window in focus.
2) I need to be able to "trap" or "hook" the keyboard input.
I want to use Win32::GUI or maybe Win32::API to get the title text. Just need the code to get the title text of the window in focus by the system.
# Thank you for any help.
ASKER
Hello and thank you for your reply. I would need the title of all the windows open, not just explorer windows.
ASKER
That is: I would need to know the title of the in focus window, even if it isn't an explorer window. Also need notepad, consol, browser, and so forth.
ASKER
I came accross this code but am not sure how to impliment it. Any ideas?
It's a system wide keyboard hook which is what I am looking for.
For use with win32::API ?
SetWindowsHookEx(WH_KEYBOA RD_LL, (HOOKPROC)FilterFunc, GetModuleHandle(NULL), 0);
Can that be used with win32:API and if so, how? Just need a simple example and way to capture keyboard input. Seems simple enough but I need help.
It's a system wide keyboard hook which is what I am looking for.
For use with win32::API ?
SetWindowsHookEx(WH_KEYBOA
Can that be used with win32:API and if so, how? Just need a simple example and way to capture keyboard input. Seems simple enough but I need help.
ASKER
It seems that needs to be in a DLL to be able to hook system wide hooks, else it would only be a thread hook.
ASKER
Still waiting for more on this...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
would print the title for all the explorer windows open.
hope this helps.
Thanks
Ned
Open in new window