I'm developing a media player and unlike other applications when i click and open with the application, it creates a new instance. how can i prevent it from doing that and actually play the song with the same application running.
Thanks
I'm developing a media player and unlike other applications when i click and open with the application, it creates a new instance. how can i prevent it from doing that and actually play the song with the same application running.
Thanks
I use this approach for this first part of your question. Just add this code to a initialization code of your project
bool b = true;
Mutex mutex = new Mutex(true, Application.ProductName, out b);
if (!b) throw new InvalidOperationException("already running");
The second part needs some sort of interprocess communication(such as NamedPipes) which is too broad to answer in a single answer.