D
Dom
My program has "Tools" in the menu. You can click on a program and it
starts up, which I achieve this way:
--------------------------------------------
using System.Diagnostics;
Process m_Process = null;
m_Process = Process.Startup (<MyProgramTool>);
--------------------------------------------
If the user exits MyProgramTool, I capture the event and reset
m_Process to null, but I won't bother you with the code -- trust me,
it works well.
I set things so that if the user again tries to start MyProgramTool,
the program will detect that the process is already started, and it
will just bring it to the Foreground:
--------------------------------------------------
using System.Runtime.InteropServices;
[DllImport("USER32.DLL", CharSet = CharSet.Auto)]
static extern bool SetForegroundWindow(IntPtr hWnd);
SetForegroundWindow(m_Process.MainWindowHandle);
starts up, which I achieve this way:
--------------------------------------------
using System.Diagnostics;
Process m_Process = null;
m_Process = Process.Startup (<MyProgramTool>);
--------------------------------------------
If the user exits MyProgramTool, I capture the event and reset
m_Process to null, but I won't bother you with the code -- trust me,
it works well.
I set things so that if the user again tries to start MyProgramTool,
the program will detect that the process is already started, and it
will just bring it to the Foreground:
--------------------------------------------------
using System.Runtime.InteropServices;
[DllImport("USER32.DLL", CharSet = CharSet.Auto)]
static extern bool SetForegroundWindow(IntPtr hWnd);
SetForegroundWindow(m_Process.MainWindowHandle);