Is it possible to establish a connectie between 2 programs so they can exchange data??
Printable View
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.Quote:
Originally posted by jacsoft
Is it possible to establish a connectie between 2 programs so they can exchange data??
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?
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.
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??
You could do it as per this article....
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
Trust me, Inter process communication using registered windows messages is the way to do this....
Has anyone got a good sample to check, cause if I have to figure it all out it would take ages. SO ???
USE DDE.
Winsock.ocx
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.
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.
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.Quote:
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.
You can also use Pipes. Take a look in MSDN.
Z.
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.Quote:
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.
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.
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!!!!!)Quote:
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.