F
Franz
I want to maintain single instane of my application. So I use the following
code.
bool bCreateNew;
string strName = "Temp";
_Mutex = new System.Threading.Mutex(true, strName, out bCreateNew);
if (bCreateNew == false) {
IntPtr hPrePop = FindWindow(null,strWindowName);
if (hPrePop != IntPtr.Zero)
{
//Pop up the previous instance
ShowWindow(hPrePop);
SetForegroundWindow(hPrePop);
}
}
But my application is originally put in the tray, I want the application to
return from tray if the user attempt to open a new instance. So how can I
call the previous instance to set the the visiblity of the tray icon to be
false? What I mean is puting what code inside the if - block (i.e. if
(hPrePop != IntPtr.Zero)) can achieve my goal?
code.
bool bCreateNew;
string strName = "Temp";
_Mutex = new System.Threading.Mutex(true, strName, out bCreateNew);
if (bCreateNew == false) {
IntPtr hPrePop = FindWindow(null,strWindowName);
if (hPrePop != IntPtr.Zero)
{
//Pop up the previous instance
ShowWindow(hPrePop);
SetForegroundWindow(hPrePop);
}
}
But my application is originally put in the tray, I want the application to
return from tray if the user attempt to open a new instance. So how can I
call the previous instance to set the the visiblity of the tray icon to be
false? What I mean is puting what code inside the if - block (i.e. if
(hPrePop != IntPtr.Zero)) can achieve my goal?