Re: Single instance behaviour like Messenger and Outlook
From: Sean Hederman (usemy_at_blogentry.com)
Date: 03/24/05
- Next message: Tim Mackey: "Re: How to insert combobox into WinForm"
- Previous message: Jeffrey Tan[MSFT]: "RE: LinkLabel in a datagrid on a Windows form"
- In reply to: Stephen Inkpen: "Single instance behaviour like Messenger and Outlook"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Mar 2005 09:46:47 +0200
I'd use 3/4
(http://www.yoda.arachsys.com/csharp/faq/#one.application.instance). To
avoid large startup costs you can have your application EXE actually be a
shim that just does that approach. If it doesn't pick up another instance
running, it then proceeds to start the main application. This can work quite
nicely in conjunction with the Application Updater Block.
"Stephen Inkpen" <sinkpen@nl.rogers.com> wrote in message
news:90f78105.0503211233.60b32a4a@posting.google.com...
>I am trying to duplicate the single instance behaviour of Messenger
> and Outlook. When the 'X' is pressed, the applications minimize to the
> system tray. They can then be brought to the foreground either by
> running the program from the start menu or by double-clicking the icon
> in the system tray.
>
> I've looked at various ways of attempting to accomplish the same
> behaviour but have not found one I particularly like. If anyone has
> any ideas other than the ones I mention below please send them along.
> Also, if there is anyone who knows how Messenger or Outlook does it,
> that solution would be gold.
>
> 1. Get MainWindowHandle from process object. Unfortuneatly, the window
> is hidden so this value returns 0.
>
> 2. Iterate through all the Windows in the system, matching the text.
> Didn't have much luck but I really didn't think that was a very
> elegant way of doing it anyways... specially since my window label may
> change.
>
> 3. Client/Service socket. If the application is already running
> (Mutex) then connect to the server (first instance) and tell it to
> restore itself. This is doable but seems to be overkill.
>
> 4. Remoting. Same as 3 but also seems to be overkill just to restore
> the initial application.
>
> I would really like to know how Messenger or Outlook does it as their
> method does seem to work quite well and has been tested extensively.
>
> Thanks,
>
> Stephen Inkpen
- Next message: Tim Mackey: "Re: How to insert combobox into WinForm"
- Previous message: Jeffrey Tan[MSFT]: "RE: LinkLabel in a datagrid on a Windows form"
- In reply to: Stephen Inkpen: "Single instance behaviour like Messenger and Outlook"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|