Jump to content

View more

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Having a program send input to another program

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 SonicD007   Members   

464
Like
0Likes
Like

Posted 01 May 2011 - 10:37 AM

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!

#2 nfries88   Members   

1154
Like
1Likes
Like

Posted 01 May 2011 - 04:33 PM

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.

#3 rip-off   Moderators   

10891
Like
0Likes
Like

Posted 01 May 2011 - 04:42 PM

Using standard windows APIs, such as FindWindow() and SendMessage().

#4 SonicD007   Members   

464
Like
0Likes
Like

Posted 01 May 2011 - 05:08 PM

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



#5 SimonForsman   Members   

7633
Like
0Likes
Like

Posted 01 May 2011 - 05:59 PM

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)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.