using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows;
namespace ConnectPoint
{
///
/// App.xaml 的交互逻辑
///
public partial class App : Application
{
[DllImport("user32", CharSet = CharSet.Unicode)]
static extern IntPtr FindWindow(string cls, string win);
[DllImport("user32")]
static extern IntPtr SetForegroundWindow(IntPtr hWnd);
[DllImport("user32")]
static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32")]
static extern bool OpenIcon(IntPtr hWnd);
System.Threading.Mutex mutex;
///
/// 程序入口
///
public App()
{
Startup += new StartupEventHandler(App_Startup);
}
///
/// 程序启动初始化
///
///
///
void App_Startup(object sender, StartupEventArgs e)
{
mutex = new System.Threading.Mutex(true, "ConnectPoint", out bool ret);
if (!ret)
{
//ActivateOtherWindow();
Environment.Exit(0);
}
else
{
MainWindow _MainWindow = new MainWindow
{
WindowStyle = WindowStyle.None,
WindowState = WindowState.Minimized,
ShowInTaskbar = false,
};
_MainWindow.Show();
}
}
}
}