views:

57

answers:

1

I am having trouble writing a program that I want to be active always.

I wrote code on keydown to do something, but when form1 is minimized or in tray keydown event does not response. How can I get my application to respond to keyboard events even when it is not in focus?

addition :

its window app , and lang is c#.NET ,

A: 

If I can assume that this program is for Windows, you cannot do that. Once you application window is closed, it will not raise KeyUp/KeyDown. Nearest to what you want is either hotkeys (to activate program once specific key is detected) or keyboard hook (if you wish to have overview of every key press).

However, what you will use depends on which exact scenario were you thinking about.

Josip Medved