ldj/wince/DeiNiuWmsWINCE/Program.cs

41 lines
1.0 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00
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));
}
}
}