ldj/wince/DeiNiuWmsWINCE/Program.cs

41 lines
1.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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));
}
}
}