Single instance behaviour like Messenger and Outlook

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Stephen Inkpen (sinkpen_at_nl.rogers.com)
Date: 03/21/05

  • Next message: gaidar: "Re: Controls and Docking"
    Date: 21 Mar 2005 12:33:27 -0800
    
    

    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: gaidar: "Re: Controls and Docking"

    Relevant Pages

    • Re: 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, ... Unfortuneatly, the window ...
      (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: 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)
    • Re: Outlook 2003 System Tray Icon
      ... panel a means to disable the System Tray icon. ... deliberately to Outlook 2003 in direct response to users' requests. ... reading. ...
      (microsoft.public.outlook)
    • Re: Can Outlook 2003 use MSN Messenger INSTEAD of Windows Messenge
      ... it just didn't recognize the existance of a Messenger ... I'll just boot up MSN Messenger separately from Outlook. ... After deleting and then undeleting the Windows Messenger .exe file, ...
      (microsoft.public.outlook)