简体   繁体   中英

Sharing data between two independent Windows applications in C#

I have two applications that use my clients database(s), but have no mutual dependency. The problem is that I need to make an application for configuration in which the administrator could set the parameters. For instance which database to which the two applications connect and some other parameters, mostly string and numerical. These parameters must affect both applications.

The first solution that I thought of is to make a configuration file in which I could store the data and the applications would read that file on startup. The problem with this approach is that it is not very safe (even if I encrypt the data in the file).

Is there a way to send data from one application to the other, assuming that each application is created as an individual project?

You can use Memory-Mapped Files

You can use it as a file, and access from different executables.

Build your own class for interfacing with it.

Tutorials:

Programming Memory-Mapped Files with the .NET Framework

Working with memory mapped files in .NET 4

or you can even use named pipe : http://www.eggheadcafe.com/articles/20060404.asp Or make communication with socket.

You have a plenty of solution. If you need more details, feel free to ask.

Best regards, Sylvain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM