views:

26

answers:

2

I would like to know how I can generate system wide events programatically on Windows. I am thinking of generating system wide events such as key presses, touch events and mouse clicks mainly.

Is it possible to generate these events with an user mode application or I need to write drivers for this? Any samples or links would be usefull.

+1  A: 

(What programming language are you using?) It's possible in regular applications. What you need are "hooks" which are supported by the Win32 API. Here is an article on hooking in C#. Some are using the EasyHook library.

EDIT:

Here is the help on this topic in the Win32 API itself.

steinar
@steinar, thanks for the reply. I am planning to use C# as programming language.
gyurisc
+2  A: 

Use SendInput().

Hans Passant
Would it be possible to generate TOUCH messages this way?
gyurisc
I seriously doubt it. I don't see anything in the touch API to do this. I'd suggest you start a new question dedicated to this.
Hans Passant