Hi. I'm trying to create a sort of keylogger application that records everything the user types on a computer.

Now I have to add this feature onto a watchdog application that I developed as a window application hidden showing a notify icon.

Now what i'm trying to do is when a key is pressed, add that key to a file that the watchdog will write to. I could do all of that but there is one thing missing.

I could add a Key event handler so when a key is pressed, something is done e.g.:

Code:
private void AddEvent(Control control)
{
	control.KeyDown += new KeyEventHandler(control_KeyDown);

	foreach (Control co in control.Controls)
	{
		AddEvent(co);

	}

}
...

private void control_KeyDown(object sender, KeyEventArgs e)
{
	// User presses A, Key numeration code is 65.
	if (e.KeyValue == 65)
	{
				MessageBox.Show("A");

	}

}
This works fine, but since the watchdog is an application, this handler only kicks in when the application is on focus. The way it has to work is in the background even if the application is not in focus.

Does anyone know how to do this?

Jennifer