harry12
asked on
Communication between C++ / C# applications
I am launching an applicaton written in C# from within a C++ application and need to pass data to the C# application when it is launched and pass data back to the c++ application when the c# application is closed. How can I accomplish this? I tried comman line arguments for the C++ to C# side and WM_COPYDATA for c# to c++ to no avail.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
They are basic UI apps where the user enters in data and the data entered is eventually saved to a file. The C++ app should send data from a file to the c# app where the data will get updated. The c# app needs to send the updated data back to c++ app where it will be saved.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the files do not have a lot of read/writes uses it and it is not slow, then you can use the file as a means of communication. Just be aware that your programs must :
- Lock the file for multiple read and exclusive write. e.g.
lock alternatives
FileShare
- File permissions
- File contents encoding (ASCII, UTF-8 or Unicode)
- Lock the file for multiple read and exclusive write. e.g.
lock alternatives
FileShare
- File permissions
- File contents encoding (ASCII, UTF-8 or Unicode)
If your C# application is a console application, I would suggest to output your result of your C# app to the console and trap the output from your C++ application.
There are lots of examples of that in internet, for example:
http://stackoverflow.com/questions/300669/launch-app-capture-stdout-and-stderr-in-c
http://ubuntuforums.org/showthread.php?t=610271
There are lots of examples of that in internet, for example:
http://stackoverflow.com/questions/300669/launch-app-capture-stdout-and-stderr-in-c
http://ubuntuforums.org/showthread.php?t=610271
can you modify them (C# app) to a server app?