How can I make my already running C# Windows Form Application be able to receive commands from the command line while it is already running?
For example: if my application is playing a video now then I want to be able to type on the command line "MyApp /stop" so that while the application is still running it stops the playing the video without exiting from current session.
From your question it seems that your first process is still running and you start a second instance of it, and you wish that instance to communicate with the first.
What you are looking for is called inter-process communication (IPC). The standard way of doing this in .NET is to use Windows Communication Foundation (WCF).
One way would be to make your app a singleton, and whenever another instance is run, it will pass arguments to the already running process.
Example: http://www.codeproject.com/KB/cs/SingletonApplication.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With