views:

165

answers:

3

I want to develop some utility on perl for autocompleting words. Is there any effective way in Perl to hook the keyboard on win32 (thread hook/surelly not system hook ) and catch an event when a key is clicked?

I want to intercept the keyboard before the message sent to the OS like setwindowshookex win32 api and to process the message (add the autocompletation functionality ) then continue currently i have app with richedit text when the user write on the app a word he wrote before (we saved on some place ) then the autocomplation done.

I know it can be done with the use of win32::api

If there a module on perl that do that for me it could be awesome ?

+1  A: 

There's a CPAN module for this: Term::ReadKey. You may also want to check out perldoc -f getc. There's nothing really in your question that's unique to Perl -- you just want to read characters from a buffer or stdin and process them individually.

Ether
A: 

Hi Ether I mean I want to set hook on the keyboard like setWindowshookex api or get an event if the key is pressed and do some operation on (autocompleting) then continue as usual ,getc is not sutable of that (on getc the proccessing is done after the key is sent ).

dov yor
Don't post non-answer answers. Delete this 'answer' and edit your question to clarify, expand and add new information.
Sinan Ünür
A: 

On Win32, if you want full control over the console, you can do so with the use of Win32::Console.

Brad Gilbert