What do I need to do so my code can influence other programs?


How can I make my program influence other's activity/read other's data?
I'm really curious:)

Some example programs to show you what I mean:

Programs that check screen, and react, like:
- If "poke" appears on some screen section, program will "click" it.("facebook automatic poke" ;-) )

Automatic programs that do something, without any conditions
- Refresh site in firefox every 5 seconds

Programs that check for other programs' activity and react:
- If code::blocks started, open foobar and start playing music :)

Programs that send input to programs and react basing on their outputs:
- bots
- parental control programs

Basically, I would like to know how can I get have stuff like this done. It would be also great if there is some article/source saying how hacks/viruses influence other programs, and how can I detect it and fight it(like, fighting bots in games).

I think that's it. Sorry if this question has been already asked. I'm hoping for nice answers, and thank you all in advance :)

PS. I forgot what I originally had in mind - programs that allow to check for memory leaks got me wondering. So these also count to list. Thanks again :)
Last edited on
If you're going to write bot program simulating real user you probably need:

- To read whole screen's (or selected window's) content look at BitBlt.

- To send fake input (eg. mouse click, keypress) to other windows applications look at: FindWindow, SendMessage.

If You need to go deeper (i.e. do more than real user see/do) you may be interested also in:

- To read/write memory of another processes please look at:
ReadProcessMemory, WriteProcessMemory, VirtualProtect.

- To run code in context of another process look at: CreateRemoteThread.

- To catch window messages from other processes look at SetWindowsHookEx.

All above funcions are part of WINAPI and are documented on msdn.

Last edited on
Thank you very much for your answer! I will check it out :)
Topic archived. No new replies allowed.