private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     AppHotKey.UnRegKey(mainForm.Handle);
     if (checkBox1.Checked)
     {
         AppHotKey.RegHotKey(mainForm.Handle, comboBox1.SelectedIndex);
     }
     Config.SaveHotkeyConfig(new Config.HotKeyConfig(comboBox1.SelectedIndex, checkBox1.Enabled));
 }
Exemplo n.º 2
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_HOTKEY:     //窗口消息-热键ID
                switch (m.WParam.ToInt32())
                {
                case AppHotKey.HotKeyID:         //热键ID
                    HotKeyPressedHandler();
                    break;

                default:
                    break;
                }
                break;

            case WM_DESTROY:                                    //窗口消息-销毁
                AppHotKey.UnRegKey(Handle, AppHotKey.HotKeyID); //销毁热键
                break;

            case WM_COPYDATA:
                COPYDATASTRUCT cds = new COPYDATASTRUCT();

                Type t = cds.GetType();

                cds = (COPYDATASTRUCT)m.GetLParam(t);

                string strResult = cds.lpData;

                string strType = cds.dwData.ToString();
                if (strResult == "GN_EXIT")
                {
                    Environment.Exit(0);
                }
                break;


            default:



                break;
            }
            base.WndProc(ref m);
        }