Receiving keyboard events, even if app does not have focus 
Author Message
 Receiving keyboard events, even if app does not have focus

I'd like to write a program that reminds the user to take a typing break
after a certain amount of typing activity. However, to do this, I'd need
an application that receives an event each time a key is pressed, even
when the user is interacting with another program. Is this possible?

Lorin Hochstein



Mon, 08 Nov 2004 01:45:41 GMT  
 Receiving keyboard events, even if app does not have focus
Lorin, this is possible but not with C#, you'll have to go with C++ to
create a global system hook.  There are a few posts with more info on this
subject in this newsgroup and in microsoft.public.dotnet.languages.vc.  To
get you started you will need to use the SetWindowsHookEx() API.

--
Greg
http://www.claritycon.com/


Quote:
> I'd like to write a program that reminds the user to take a typing break
> after a certain amount of typing activity. However, to do this, I'd need
> an application that receives an event each time a key is pressed, even
> when the user is interacting with another program. Is this possible?

> Lorin Hochstein



Mon, 08 Nov 2004 02:30:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie question: Response to keyboard events when no in focus

2. Problems with checkboxes not being highlighted on receiving focus

3. interop kernel32 (GetOverlappedResult) does not block even though it's event has been fired

4. User control not to receive focus

5. Help ...View not getting keyboard focus..

6. my vc6 console app needs to receive events

7. NotifyIcon handler not receiving mouse events

8. Not receiving events in VB

9. Custom control not receiving key events -- why?

10. Receiving events from VB.Net into C# not working

11. Not receiving system messages in CDialog derived app

12. Not receiving system messages in CDialog derived app

 

 
Powered by phpBB® Forum Software