示例#1
0
        private const int WM_DESTROY = 0x2;   //窗口消息:销毁

        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);
            switch (msg.Msg)
            {
            case WM_HOTKEY:     //窗口消息:热键
                int tmpWParam = msg.WParam.ToInt32();
                if (tmpWParam == HotKeyID)
                {
                    do_work();
                }
                break;

            case WM_CREATE:     //窗口消息:创建
                SystemHotKey.RegHotKey(this.Handle, HotKeyID, SystemHotKey.KeyModifiers.Ctrl, Keys.L);
                break;

            case WM_DESTROY:                                     //窗口消息:销毁
                SystemHotKey.UnRegHotKey(this.Handle, HotKeyID); //销毁热键
                break;

            default:
                break;
            }
        }
示例#2
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case DefaultMessageValue.WmHotKey:
                switch (m.WParam.ToInt32())
                {
                case 100:
                    buttonCaptureImage_Click(null, null);
                    break;
                }
                break;

            case DefaultMessageValue.WmCreate:
                SystemHotKey.RegHotKey(Handle, 100, KeyModifiers.Ctrl | KeyModifiers.Alt, Keys.Z);
                break;

            case DefaultMessageValue.WmDestory:
                SystemHotKey.UnRegHotKey(Handle, 100);
                break;

            case DefaultMessageValue.WmSyscommand:
                if (m.WParam.ToInt32() == DefaultMessageValue.ScMinimize)
                {
                    WindowState   = FormWindowState.Minimized;
                    ShowInTaskbar = true;
                }
                break;

            case DefaultMessageValue.WmRbuttondown:
                //int i = 43;
                break;
            }
            base.WndProc(ref m);
        }
示例#3
0
 protected override void OnClosed(EventArgs e)
 {
     if (NotiCenterWindowViewModel.IsHotKeyEnabled)
     {
         SystemHotKey.UnRegHotKey(_thisWindowHandle, c_hotKeyId);
     }
     base.OnClosed(e);
 }
示例#4
0
 protected override void OnClosed(EventArgs e)
 {
     if (AppUtil.IsHotKeyEnabled)
     {
         SystemHotKey.UnRegHotKey(_thisWindowHandle, c_hotKeyId);
     }
     base.OnClosed(e);
 }
示例#5
0
 protected override void OnClosed(EventArgs e)
 {
     if (AppUtil.IsHotKeyEnabled)
     {
         SystemHotKey.UnRegHotKey(_thisWindowHandle, c_hotKeyId);
     }
     hwndSource?.Dispose();
     hwndSource = null;
     base.OnClosed(e);
     Application.Current.Shutdown();
 }
示例#6
0
 private bool RegHotKey(System.Windows.Forms.Keys key, out string message)
 {
     if (!SystemHotKey.RegHotKey(_thisWindowHandle, c_hotKeyId, SystemHotKey.KeyModifiers.Alt | SystemHotKey.KeyModifiers.Ctrl, key, out message))
     {
         message = $"Ctrl + Alt + {key.ToString()} " + message;
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#7
0
 protected override void OnClosed(EventArgs e)
 {
     if (ClientAppType.IsMinerClient)
     {
         if (AppUtil.IsHotKeyEnabled)
         {
             SystemHotKey.UnRegHotKey(_thisWindowHandle, c_hotKeyId);
         }
         hwndSource?.Dispose();
         hwndSource = null;
     }
     base.OnClosed(e);
 }
示例#8
0
        //重载系统方法,用于处理热键
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);
            switch (msg.Msg)
            {
            case WM_HOTKEY:     //窗口消息:热键
                int tmpWParam = msg.WParam.ToInt32();
                //MessageBox.Show("hot key:" + tmpWParam);
                //ctrl+NumPad0开启自动跟踪
                //ctrl+enter关闭自动跟踪
                if (usbDevice != null && systemStatus != null)
                {
                    if (tmpWParam == HotKeyID1)
                    {
                        usbDevice.IfAutoTrace(true);
                        systemStatus.autoTrace = usbDevice.autoTrace;
                        this.textBox_msg.Text  = systemStatus.GetSytemStatus();
                        ShowToolTip("已开启自动跟踪");
                    }
                    else if (tmpWParam == HotKeyID2)
                    {
                        usbDevice.IfAutoTrace(false);
                        systemStatus.autoTrace = usbDevice.autoTrace;
                        this.textBox_msg.Text  = systemStatus.GetSytemStatus();
                        ShowToolTip("已关闭自动跟踪");
                    }
                    else if (tmpWParam == HotKeyID3)
                    {
                        ShowToolTip("测试热键");
                    }
                }
                break;

            case WM_CREATE:     //窗口消息:创建
                SystemHotKey.RegHotKey(this.Handle, HotKeyID1, SystemHotKey.KeyModifiers.Ctrl, Keys.NumPad0);
                SystemHotKey.RegHotKey(this.Handle, HotKeyID2, SystemHotKey.KeyModifiers.WindowsKey, Keys.NumPad0);
                SystemHotKey.RegHotKey(this.Handle, HotKeyID3, SystemHotKey.KeyModifiers.Alt, Keys.Add);
                break;

            case WM_DESTROY:                                      //窗口消息:销毁
                SystemHotKey.UnRegHotKey(this.Handle, HotKeyID1); //销毁热键
                SystemHotKey.UnRegHotKey(this.Handle, HotKeyID2); //销毁热键
                SystemHotKey.UnRegHotKey(this.Handle, HotKeyID3); //销毁热键
                break;

            default:
                break;
            }
        }
示例#9
0
        public formMain()
        {
            InitializeComponent();

            // Create the tab manager
            tabControlMain.TabPages.Clear();
            tabManager = new oTabManager(tabControlMain, toolStrip2, panelVisualization, panelPlay, panelMain);

            // Add the basic tabs
            tabManager.addIntroTab("Introduction Page", true);
            //tabManager.addFunctionListTab("Function List: Empty", new oFunctionList( new List<oFunction>()), true );
            //tabManager.addAssemblyViewerTab("Assembly Viewer 1",false);
            //tabManager.addAssemblyViewerTab("Assembly Viewer 2",false);
            //tabManager.addMemoryViewerTab("Memory Viewer", false);

            // Main lock the tab control
            tabManager.mainLock(true);

            //Hotkey handler (we can register more hotkeys if we need them)
            hotKey = new SystemHotKey(Keys.F5, SystemHotKey.KeyModifiers.Control, OnHotKey);
        }
示例#10
0
 protected override void OnClosed(EventArgs e)
 {
     SystemHotKey.UnRegHotKey(_thisWindowHandle, c_hotKeyId);
     base.OnClosed(e);
 }
示例#11
0
 /// <summary>
 /// 注销热键
 /// </summary>
 private void UnRegisterKey()
 {
     SystemHotKey.UnRegisterKey(Handle, CtrlAndE); //注销热键
 }
示例#12
0
 /// <summary>
 /// 注册热键
 /// </summary>
 private void RegisterKey()
 {
     SystemHotKey.RegisterKey(Handle, CtrlAndE, SystemHotKey.CombinationKeys.Ctrl, Keys.E);
 }