/// <summary>
/// 应用程序的主入口点。
/// </summary>
[MTAThread]
static void Main()
{
IntPtr hDlg=IntPtr.Zero;
hDlg = FindWindow(null, "ThisWindows");//ThisWindows:应用程序主窗体名称
if (hDlg != IntPtr.Zero)
{
SetForegroundWindow(hDlg);
}
else
{
Application.Run(new Form1());
}
}
[DllImport("coredll.Dll")]
public static extern IntPtr FindWindow(String classname, String title);
[DllImport("coredll.Dll")]
public static extern void SetForegroundWindow(IntPtr hwnd);