Thread: interprocess communication question

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    89

    interprocess communication question

    Hi, I've been searching all over and reading up on interprocess communication trying to see if what I want to do is possible... An example of what I'm trying to do is make a program that would say execute a telnet session or cmd.exe or anything where you can type and actually type a message into the window. This is a simpler example than my actual goal but I think if that is possible and I can do it then I will be able to move forward with what I'm trying to accomplish. I have been reading all the posts about IPC I could find on the boards and know that you can send data structures and things to other programs via pipes and such but can you do this with programs that you havent written and are only available as executables? I mean even tho I know I can open these other processes is it feasable to think I can actually cout to their windows or do they most likely use a completely different command set? Hope my question/dilema is clear.
    Thanks,
    -Alex

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Hope my question/dilema is clear.
    Not really.... Perhaps you should slow-down and write in paragraphs...


    ...make a program that would say execute a telnet session or cmd.exe or anything...
    Yes. You can make your program execute another. Try system(cmd.exe). There may be a better way, especially if you're using the WinAPI.

    ...where you can type and actually type a message into the window.
    You want your program to automatically type into another program's Window? That's really a question for the Windows forum. It can be done. I don't think I've ever done it with C++, but it involves getting a handle to the (other) Window. (I've done it with something called WinBatch.)

    ...but can you do this with programs that you havent written and are only available as executables?
    In general, you can't "get inside" another program, unless it's a DLL or something else where it was intended and where you have the "instructions."

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    89
    Sorry, I was typing that on my way out of work and was in somewhat of a rush.

    Anyway yes I know it is possible to call up other programs but the main part of my question was whether it was possible to actually send text or virtual keystrokes even to other programs using C++.

    Your link to WinBatch seems to be right along the lines of what I am trying to do and I am going to look into it more. I assume since there has been software created to do what I am trying that it is probably not to do easy to do just in C++ like I was hoping. I kind of figured as much but just wanted to see if using straight C++ to do this was realistic.
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Secure interprocess communication
    By 3saul in forum C Programming
    Replies: 3
    Last Post: 03-23-2006, 04:25 PM
  2. Interprocess Communication
    By Zildjian in forum C Programming
    Replies: 4
    Last Post: 10-16-2004, 02:04 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Serial communication packets
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 04-26-2003, 08:33 AM
  5. Interprocess Communication and UNIX???
    By atif in forum C Programming
    Replies: 3
    Last Post: 05-17-2002, 04:47 PM