You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cigarette/Diaoyong/Program.cs

51 lines
1.8 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Diaoyong
{
static class Program
{
[DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Auto)]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ConnectionTest connectionTest = new ConnectionTest();
connectionTest.conf_Load();
connectionTest.StartPosition = FormStartPosition.CenterScreen;
connectionTest.TopMost = true;
connectionTest.Show();
connectionTest.UpdateLableStatus("正在测试连接...");
connectionTest.Refresh();//强制控件使其工作区无效并立即重绘自己和任何子控件
connectionTest.ConnectionTesting();
if (connectionTest.m_Done == false)
{
connectionTest.Close();
Form1 form = new Form1();
form.StartPosition = FormStartPosition.CenterScreen;
Application.Run(form);
}
else
{
connectionTest.UpdateLableStatus("连接失败");
DialogResult dr = MessageBox.Show("连接超时请检查IP地址和端口是否正确", "连接失败", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}