Results 1 to 18 of 18

Thread: Making 2 programs directly communicate

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574

    Making 2 programs directly communicate

    Is it possible to establish a connectie between 2 programs so they can exchange data??

  2. #2
    Fanatic Member daydee's Avatar
    Join Date
    Jun 2001
    Location
    Canada
    Posts
    560

    Re: Making 2 programs directly communicate

    Originally posted by jacsoft
    Is it possible to establish a connectie between 2 programs so they can exchange data??
    When I looked into this a few weeks back the best I could find was to have the apps exchange data through bollean variables or others using or "sharing" same registry keys or ini files.
    Basically, leaving each other messages. Actually I'm working on an app right now that runs in "stealth" mode (so-to-speak) which uses onother app to load it, close it etc. using this method both apps can be renamed for security purpose.
    I'll try to find the links I had back then if you want.
    Hope this helps?

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    The most common ways are:
    1) Use the SendMessage API to send realtime messages and data between the apps. Only works if they are both running on the same machine.
    2) The shared file/registry leave a message approach that daydee was talking about.
    3) Use a shared ActiveX Exe to exchange data in realtime, may work across a network also.

    You'll probably want to go with or look at option 1 first as that is probably the easiest with the least over head (if you need realtime) otherwise the shared file thing works great.

  4. #4
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    An idea: you can share data between your prog using a file where they talk to each other. Example:

    Prog 1 reads what prog 2 has written on line 1 and answer prog 1 on line 2. This is just a thought, why shouldnt it work??

  5. #5
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    You could do it as per this article....
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574

    I will check it out

    I will check some ideas only I don't want to use files or registery keys cause then I need to have timers to check each time if something changes and that cost to much resources. So I will check it out and will come back on this later

  7. #7
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  8. #8
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Please rate my post.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2001
    Posts
    574

    ANy samples?

    Has anyone got a good sample to check, cause if I have to figure it all out it would take ages. SO ???

  10. #10
    New Member
    Join Date
    Feb 2002
    Location
    Portugal
    Posts
    4

    Wink

    USE DDE.
    Just Me

  11. #11
    carp
    Guest
    Winsock.ocx

  12. #12
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You can use an ActiveX EXE (Out of process server) to communicate between applications,
    here's a Link to an example I posted which outlines this functionality.

  13. #13
    Stiletto
    Guest
    An idea - You can use the Winsock control to exchange data.
    Connect the 2 Winsocks to the same comp (If not network connect to 127.0.0.1) and to a specific Port and then u can 'talk' with the 2 apps.

  14. #14
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    Originally posted by Aaron Young
    You can use an ActiveX EXE (Out of process server) to communicate between applications,
    here's a Link to an example I posted which outlines this functionality.
    i love this little example, but i cannot figure out how it can be used in my mp3 player... what i want to do is make it so when you open an mp3 file, instead of opening another instance (which screws up MCI causing entire strings of errors) it will tell my program to play the mp3 file... im gunna keep screwing w/ the code though, and see if i can get it to work.
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  15. #15
    Zaei
    Guest
    You can also use Pipes. Take a look in MSDN.

    Z.

  16. #16
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Originally posted by Skitchen8
    i love this little example, but i cannot figure out how it can be used in my mp3 player... what i want to do is make it so when you open an mp3 file, instead of opening another instance (which screws up MCI causing entire strings of errors) it will tell my program to play the mp3 file... im gunna keep screwing w/ the code though, and see if i can get it to work.
    That's pretty much what my example is doing, instead of starting a 2nd instance of the EXE, it's passing the files from what would have been the 2nd instance to the 1st instance which adds it/them to the end of it's list.

  17. #17
    New Member
    Join Date
    Feb 2002
    Posts
    3
    Nice example Aaron.

    Just another idea ... if the apps are running on the same pc, you could set a textbox to receive data. The sending app finds the texbox with findwindow and then sends data to it. The receiving app can use the standard texbox events to react to the data being received.
    Yeah Right!

  18. #18
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    Originally posted by Aaron Young


    That's pretty much what my example is doing, instead of starting a 2nd instance of the EXE, it's passing the files from what would have been the 2nd instance to the 1st instance which adds it/them to the end of it's list.
    prolly just my stupidity but i couldn't understand it... i tried to do it, but it won't let me reference an exe file in my projects (it always gets errors... my computer hates me!!!!!)
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width