I am developing a command line program which needs to get information from command line switches every now and then. So instead of starting a new instance when the program is executed, it will pass an event or message to the already running program telling it what it would do.
First program.exe is executed and the program is started. Then we run program.exe /cleardatabase and the running process receives this
request and acts accordingly.
It's the messaging part that's troublesome. I've looked into the windows API(GetMessage, SendMessage) but I haven't been able to create a C# solution, and I don't think there are stuff in the .NET framework for this..
It's pretty normal for a program to act this way, but I haven't been able to find a tutorial on the matter..
What I need is a C# solution that checks if the program is running, if it is, send a message containing a string to it which the main program then can interpret. Thanks!