0

Let's say that I've got a single program (let's say that it's GIMP). I want to create an application which runs in the background. I want it to do nothing, but to "imitate" a user pressing the key f.e. once in 10 seconds, and I want the second program (f.e. GIMP) to react to this action as if it was really the user.

In other words, I guess that my program would just trigger some API-like function, which would trick the external application into assuming that the user hit f.e. Ctrl+S, and then the application would react by saving the current file.

Is it even possible in C#? I'm pretty sure that I came across this kind of code in C# a looong time ago.

I'm only asking for some direction, because so far I didn't come across anything like that in C#.

Kamil T
  • 2,232
  • 1
  • 19
  • 26

1 Answers1

3

There is a API called SendKeys that should do the trick

http://www.codeproject.com/Articles/18366/Sending-Keystrokes-to-another-Application-in-C

Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66