C#必须加某QQ群才能使用软件

public Form1()
        {
            InitializeComponent();
        }
        [DllImport("user32.dll", EntryPoint = "FindWindow")]
        private static extern IntPtr FindWindow(string IpClassName, string IpWindowName);
        /// <summary>
        /// 找到句柄
        /// </summary>
        /// <param name="IpClassName">类名</param>
        /// <returns></returns>
        public static IntPtr GetHandle(string IpClassName, string IpWindowName)
        {
            return FindWindow(IpClassName, IpWindowName);
        }
        private void Form1_Load(object sender, EventArgs e)
        {

            IntPtr cz = GetHandle("TXGuiFoundation", "HR_2014");//查询是否有此群的聊天窗口,第二个参数是群名,修改群名就行了
            if (cz == IntPtr.Zero)
            {
                MessageBox.Show("请加群后再启动本软件");
                Application.Exit();
            }
          
        }

展开阅读全文

没有更多推荐了,返回首页