C++ How to make two programs communicate? C++ How to make two programs communicate? windows windows

C++ How to make two programs communicate?


there are many solutions with many pros and cons. you will have to do some reading on each to work out which is best for you. no solution is best for everyone

here is a good starting place http://msdn.microsoft.com/en-us/library/aa365574(v=vs.85).aspx


Honestly, I'd most likely take the network-based approach. It decouples the standalone software and the plugin and as such, you could easily hook your plugin into any number of other utility programs or scripts as long as the communication protocol matches.

So, I'd probably develop the plugin to act as a server, receiving commands and responding with statuses (hey, you could even follow the HTTP standard if you really wanted to ;)).

And if you ever wanted to do cross-machine communication, it comes for free :)

Of course, depending on the software and the usage, I'd encrypt the communication.


If you're using Qt, I believe it has the notion of Plugin: How to Create Qt Plugins

Otherwise, COM works fine. With C++ , I would use the ATL library, but there is also COM support in Qt.

If you want to go more low level, I would use sockets or named pipes (since you're working with Windows)