Problem in Mutex with System Tray Icon.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Problem in Mutex with System Tray Icon.

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Problem in Mutex with System Tray Icon.

    Hi all,

    i Have SDI type application,I m creating a Mutex to avoid multiple instance of application. and use system tray icon feature.

    for creating mutex i m using this code:

    <pre>
    HANDLE hMutex = ::CreateMutex(NULL, TRUE, _T("GlobalMainMutex"));

    switch(::GetLastError())
    {
    case ERROR_SUCCESS:
    // Mutex created successfully. There is no instance running
    break;

    case ERROR_ALREADY_EXISTS:

    // Mutex already exists so there is a running instance of our app.
    return FALSE;

    default:
    // Failed to create mutex by unknown reason
    return FALSE;
    }
    </pre>

    for system tray icon i m taking help of this article.

    <a href=""></a><a href="http://www.codeproject.com/KB/shell/systemtray.aspx">http://www.codeproject.com/KB/shell/systemtray.aspx</a>[<a href="http://www.codeproject.com/KB/shell/systemtray.aspx" target="_blank" title="New Window">^</a>]

    My problem is that is application is already running and its in hide mode and icon present in system tray,now when i click on my exe than its not open becoz of mutex.

    i what when application is already running or its hide than if i click on exe icon than the hide application can show.

    please tell me how can i do this.

    thanks in advance.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  2. #2
    Join Date
    Nov 2003
    Posts
    1,793

    Re: Problem in Mutex with System Tray Icon.

    You could use a named event to signal the already running instance to show itself.

    gg

  3. #3
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Re: Problem in Mutex with System Tray Icon.

    Please can u explain me with example.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center