Re: Mutex and messages
From: Andreas Håkansson ("Andreas)
Date: 04/05/04
- Next message: ItNerd: "OnItemDataBound issue..."
- Previous message: Vangelis: "How to retrieve a computer comment over the network?"
- In reply to: William Stacey [MVP]: "Re: Mutex and messages"
- Next in thread: Mark Rae: "Re: Mutex and messages"
- Reply: Mark Rae: "Re: Mutex and messages"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 5 Apr 2004 19:25:17 +0200
William,
Remoting, Other IPC:s such as mailslots, send message .. <insert
more ideas here>
HTH,
//Andreas
"William Stacey [MVP]" <staceywREMOVE@mvps.org> skrev i meddelandet
news:uWyAlEzGEHA.1268@TK2MSFTNGP12.phx.gbl...
> Unless I miss an easy solution, this would require some kind of IPC
message.
> 1) User clicks on file ex.
> 2) New app opens.
> 3) New app gets file name, and figures out another instance is open.
> 4) It sends a message to a Named Pipe or Memory mapped file, or file.
> 5) It also signals a named event that first blocks on in another thread.
> 6) First app unblocks wait thread and figures out the file name and does
> what ever.
>
> I guess you could simplify by using a known hidden file or something.
Then
> when you get the event, you open and look in the file for file name and
path
> and do your thing. Other possibilities here. HTH
>
> --
> William Stacey, MVP
>
> "Mark Rae" <mark@markrae.co.uk> wrote in message
> news:OfHd3wyGEHA.688@tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I have a WinForms desktop MDI application written in C#. Following
advice
> > from others in this forum, I prevent multiple instances of the app
running
> > at the same time by creating / trying to create a mutex, as follows:
> >
> > bool blnCreatedMutex;
> > objMutex = new System.Threading.Mutex(true, "zzzzzzMyCoolAppzzzzz",
> out
> > blnCreatedMutex);
> > if (!blnCreatedMutex)
> > {
> > MessageBox.Show("My Cool App is already running", "Error",
> > MessageBoxButtons.OK, MessageBoxIcon.Stop);
> > this.Close();
> > return;
> > }
> >
> > The app saves data files onto the file system, and I have associated
these
> > files' extension with the app's executable. All is well - I interrogate
> the
> > args property when the app loads and try to open any files found there
> e.g.
> >
> > foreach (string strArg in astrArgs)
> > {
> > openFile(strArg);
> > }
> >
> > No doubt you can all guess the next question... :-) if the app is
already
> > running, and the user double-clicks one of its files, I want to somehow
> get
> > a message to it to open the file(s) found in the args of the second
> > instance, which I will then terminate.
> >
> > Any assistance gratefully received.
> >
> > Best,
> >
> > Mark
> >
> >
>
- Next message: ItNerd: "OnItemDataBound issue..."
- Previous message: Vangelis: "How to retrieve a computer comment over the network?"
- In reply to: William Stacey [MVP]: "Re: Mutex and messages"
- Next in thread: Mark Rae: "Re: Mutex and messages"
- Reply: Mark Rae: "Re: Mutex and messages"
- Messages sorted by: [ date ] [ thread ]