views:

28

answers:

1

Hi, in my application (http://tabbles.net) I need to offer a "global search" shortcut key like you see in google desktop: if you press CTRL+CTRL at any time (regardless of which application is active and has keyboard focus), a dialog box must pop up where you must be able to type a search text and press enter.

This requires stealing focus from the active application.

So far I was able to install a global key hook and use that to detect the key combination and display a dialog box. I made the dialog topmost, so it always appears on top of the active application. However, the user cannot type anything in the dialog without first clicking on it with the mouse, because I cannot give focus to the textbox inside the dialog. So the user must click with the mouse before typing, which is a burden.

Is there anyway to circumvent Windows focus stealing prevention? Thank you.

A: 

I was able to do that by using RegisterHotKey instead of a global key hook.

seguso