Sending input to another application

im trying to send a string as input to another application, i tried tried the keybd_event() and SendInput() APIs but they seem to be blocked by the application(app crashs). on the other hand if i try at it from a .net perspective and use an API such as SendKeys::send() it works fine,

so i guess im asking for a little clarification on what SendKeys::send() actually does, all along i thought its a wrapper kinda thing for keybd_event() ,, and how would i go about sending my input/string into this application without any managed code
There are a few ways to do this: You could use sockets, events, shared memory, etc. I like to uses events on Windows. Look at CreateEvent() and WaitForSingleObject().
did You try running the progam with administrator privileges?
@Incubbus: I'm curious as to where you're going with that one. How would the users access control token matter if both of the programs are running in user space?

@OP: What kind of commands are you trying to send? Are you sure the correct component of the program has focus? Here is that .NET command entry from MSDN http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
If you set the Language filter to allow C++ this should be as close to the same command as you can get.
@Computergeek01 : I'm just trying to send a string for starters, something like "abc123", and the window is in focus, but its still the same..

the problem isn't from my code, because i tried it in an empty notepad process and it worked, but when i try it in this other app, its causing a crash,, do note the app does have protection for this kind of thing, i tried hooking some if its input handling functions and got the same result there as well, whats puzzled me though is why would SendKeys::send() work and non of the other standard WINAPI fucntions
@Geek: I encountered the same problem as the OP did, once. My solution was to elevate the access rights... (vista and 7)
Topic archived. No new replies allowed.