Re: Single instance behaviour like Messenger and Outlook

From: Sean Hederman (usemy_at_blogentry.com)
Date: 03/24/05


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



Relevant Pages

  • Single instance behaviour like Messenger and Outlook
    ... I am trying to duplicate the single instance behaviour of Messenger ... in the system tray. ... Also, if there is anyone who knows how Messenger or Outlook does it, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • RE: Single instance behaviour like Messenger and Outlook
    ... > in the system tray. ... > Also, if there is anyone who knows how Messenger or Outlook does it, ... Unfortuneatly, the window ... > I would really like to know how Messenger or Outlook does it as their ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: R6025 - pure virtual function call
    ... The R6025 error is being dealt with, but you can stop the Outlook Express issue by closing ... Microsoft MVP - Windows Messenger/MSN Messenger ... > it appear after i install the lastest MSN messenger 7.0.0777. ... Window is updated to ...
    (microsoft.public.windowsxp.messenger)
  • Re: Removal of Messenger from system tray
    ... However, to stop this behavior with Outlook, ... Microsoft MVP - Windows Messenger/MSN Messenger ... > icon in the system tray. ...
    (microsoft.public.windowsxp.messenger)
  • Problems on shut down or restart
    ... I close the main Outlook ... window, but it is still running in my system tray. ... kill it by bringing up the Task Manager and killing ...
    (microsoft.public.outlook)

Loading