Dreamist
Dreamist

Reputation: 123

How to capture keystrokes before the foreground window gets it?

I'm doing an application like Google Transliteration (Google input tools) tool in C#. It displays the suggestion window on the top of whatever window we are typing (finds caret location & display just window below it). But the focus (foreground process) is still on the application in which we type (for eg. Ms Word, Notepad etc.).

I want to implement these features of Google Transliteration:

Google Input Tools (while renaming a folder...

I want to implement a universal text suggestion list (window) like that of Google Transliteration.

How to capture keystrokes before another process gets it (block foreground process from getting it)? (Main Question)

How to capture keystrokes (up & down arrow keys and enter key) and select an option from the words list without focusing on the 'words list' window? (Caret should remain active and blinking on the foreground process text field. eg. Folder rename text field)

Someone please help me to solve this problem. I already found this one, but it not helped me to solve my problem. Capturing keystrokes without focus

Upvotes: 3

Views: 513

Answers (1)

Alex Butenko
Alex Butenko

Reputation: 3764

You mix two different problems. The first problem - to catch keyboard input - nothing to do with the second - to make an unfocusable window.

The solution to the first problem is very simple - as stated in your link, there is no other way to do it other than Low-Level windows hooks.

The second problem is more difficult, the solution may require a little experimentation, creativity and knowledge of WinAPI. Examples are here, here and here.

Upvotes: 1

Related Questions