0

I want to be able to write a WPF application that only allows one instance of it, but if the user opens another instance, the first instance opens a window. So, I need

  1. Single instance only WPF application
  2. Inter-process communication between new instances and the original, which allows the new instances to tell the first one to open a window.

I would like to know if this is possible, and how to do it, because so far, Google hasn't been of much help. I have seen other questions ask this problem, but none have actually been of help (and a few have not been in vb.net, but have still not answered this problem). I would really like a proper example of how to do this, because even though I have been using vb.net for a while, this sort of stuff I have never encountered.

lizclipse
  • 1
  • 2

1 Answers1

1

Single instance only WPF application

You can use a named Mutex to ensure only one instance is running, see “make single instance application” what does this do? (example given in VB.Net)

Inter-process communication between new instances and the original

There are a number of options here, including WCF, .Net Remoting and Named Pipes, see What is the best choice for .NET inter-process communication?

Community
  • 1
  • 1
Phillip Trelford
  • 6,513
  • 25
  • 40
  • Thank you for the response. Do you know any good tutorials on named pipes? WCF seems a bit overly complex for what I want to do, and I haven't been able to find a good walkthrough on the named pipes. .NET remoting does might work, but that too seems overly complex, but I will look into it further. Thanks again. – lizclipse Oct 28 '14 at 01:22
  • @Gorea235 sorry, not aware of any named pipes tutorial. If it was me I'd probably be tempted to go with .Net Remoting over an IPC channel – Phillip Trelford Oct 28 '14 at 09:03
  • I shall have a look at .Net Remoting and see how much I can understand. Thanks for the help – lizclipse Oct 29 '14 at 01:38