views:

241

answers:

2

I want to send an Application Key Presses, To Automate some stuff that has to be done repeatedly and So I don't always have to cramp my fingers.

In C#, it's nice to use SendKeys.Send(), but this won't work because the Application doesn't take Windows Messages. SendKeys.SendWait() does nothing at all.

How would I STILL Simulate the Keyboard events?

Come To Think of It, I was going to use some P/Invoke to simulate Mouse Events too, but If it takes no messages, How Can I get around that?


EDIT - I can use mouse and keyboard to interact with the program, I just cannot manipulate it with Windows Messages sent from my own Code.

A: 

Is it a console app? If so, maybe you should be SendKeys'ing to the command shell instance it is running in.

1800 INFORMATION
No, This Program has no Console, sadly.
wsd
It doesn't have windows, and it doesn't have a console for normal text entry. How do you normally interact with it that you would be typing to it then?
1800 INFORMATION
It has a Window. It just won't take Windows Messages.
wsd
How do you type into it normally? Thought control?
1800 INFORMATION
I use my keyboard. I'm sorry if the question was phrased in a bad way, I'll do my best to amend it so it shows clearly that I CAN manipulate it, just no from my Code.
wsd
If you can type into it, then you can use windows messages - this is how the keyboard messages are sent to the program
1800 INFORMATION
When I try to use Sendkeys.Send, I get an InvalidOperationException which tells me the Application accepts no Windows Messages. This is Windows 7, which is similar to Vista in User priveleges. I would assume the App takes no messages from Processes with low rights, but still from those with system rights, like the keyboard driver.
wsd
+1  A: 

Have you tried AutoIt?

fretje
AutoIt - Perfect. I was able to Import the AutoItX Library into my Project in VS and It worked a charm.
wsd