41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using System;
|
||
using System.Linq;
|
||
using System.Collections.Generic;
|
||
using System.Windows.Forms;
|
||
using System.Runtime.InteropServices;
|
||
|
||
namespace DeiNiu.Wms.CE
|
||
{
|
||
static class Program
|
||
{
|
||
|
||
[DllImport("coredll.dll", EntryPoint = "FindWindow")]
|
||
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
|
||
public static bool AppRunAlready(string appName)
|
||
{
|
||
|
||
|
||
IntPtr hDlg = IntPtr.Zero;
|
||
hDlg = FindWindow(null, appName);
|
||
if (hDlg != IntPtr.Zero) //如果程序已经启动
|
||
return true;
|
||
else
|
||
return false;
|
||
}
|
||
/// <summary>
|
||
/// 应用程序的主入主函数。
|
||
/// </summary>
|
||
[MTAThread]
|
||
static void Main()
|
||
{
|
||
|
||
if (AppRunAlready("Login"))
|
||
{
|
||
MessageBox.Show("抱歉,W M S已启动,请关闭");
|
||
Application.Exit();
|
||
}
|
||
else
|
||
Application.Run(new login(false));
|
||
}
|
||
}
|
||
} |