B
Brian W
Hi all,
I'm working on a Windows App and am making it single-instance app, that part
I have working like this:
static void Main()
{
try
{
System.Threading.Mutex mutex = new System.Threading.Mutex(true,
"2F8F656D-E6E8-4646-A529-DB3D67279F6F.MyNew.Application");
if ( !mutex.WaitOne(1, true) )
{
return;
}
}
catch
{
return;
}
Application.Run(new MainWindow());
}
}
The part I'm having trouble with is activating the existing Window (Bring to
front, Restore, etc).
In the "old days" I would code my Window so it had a unique window class
name and use FindWindow blah blah blah
-- or --
I would make my app a COM server and invoke methods on COM object that would
in turn do the necessary work on the main window.
What is the best approach "these days" with .NET and the framework?
TIA
Brian W
I'm working on a Windows App and am making it single-instance app, that part
I have working like this:
static void Main()
{
try
{
System.Threading.Mutex mutex = new System.Threading.Mutex(true,
"2F8F656D-E6E8-4646-A529-DB3D67279F6F.MyNew.Application");
if ( !mutex.WaitOne(1, true) )
{
return;
}
}
catch
{
return;
}
Application.Run(new MainWindow());
}
}
The part I'm having trouble with is activating the existing Window (Bring to
front, Restore, etc).
In the "old days" I would code my Window so it had a unique window class
name and use FindWindow blah blah blah
-- or --
I would make my app a COM server and invoke methods on COM object that would
in turn do the necessary work on the main window.
What is the best approach "these days" with .NET and the framework?
TIA
Brian W