-
March 5th, 2009, 05:24 AM
#1
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
-
March 5th, 2009, 09:20 AM
#2
Re: Problem in Mutex with System Tray Icon.
You could use a named event to signal the already running instance to show itself.
gg
-
March 6th, 2009, 03:08 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|