Jump to content
  • Advertisement
Sign in to follow this  
SonicD007

Having a program send input to another program

This topic is 2789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wondering how programs send input to other programs, like EZ macro. Is it a windows hook doing this or what? It would be interesting if I could make a program automatically type "Hello World!" into notepad instead of a console screen/gui. Any links to tutorials on how to do this or what knowledge is required would be great. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You can have application A replace stdin with a pipe which application B uses for stdout. In this way, the output of application B acts as the input for application A.
You can also use a normal file for stdin, but this is more limiting.
EDIT: You can use a file for stdin, stdout, and stderr. stdin = fopen("myinput.txt", "rt"); is how that'd work.

I'm not sure if it would work the same on Windows, but it's worth investigation.

Share this post


Link to post
Share on other sites

Thank you. What about for an os other than windows? Whats the linux equivalent of that?



If you're using X11 you can use the
XSendEvent function to send events to any window.

XDefaultRootWindow gets you the root window for your display
XQueryTree lets you obtain the child windows of a given window (start from the root and work your way down the tree to get a complete list of windows)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!