• MFC CHotKeyCtrl控件


    知识点:
    CHotKeyCtrl控件
    获取热键数据
    注册热键
    响应热键事件
    
    一、CHotKeyCtrl控件
    void SetHotKey( WORD wVirtualKeyCode, WORD wModifiers );
    二、获取热键数据
    DWORD GetHotKey( ) const;
    void GetHotKey( WORD &wVirtualKeyCode, WORD &wModifiers ) const;
    三、注册系统热键
    RegisterHotKey
    The RegisterHotKey function defines a system-wide hot key.
    BOOL RegisterHotKey(
      HWND hWnd,        // window to receive hot-key notification
      int id,           // identifier of hot key
      UINT fsModifiers, // key-modifier flags
      UINT vk            // virtual-key code
    );
    四、响应热键事件
    GetParent
    WM_HOTKEY
    
    
    //获取热键值
        CHotKeyCtrl* phot=(CHotKeyCtrl*)GetDlgItem(IDC_HOTKEY1);
        WORD vkey,fsModifiers;
        phot->GetHotKey(vkey,fsModifiers);
        BOOL r=RegisterHotKey(m_hWnd,111,fsModifiers,vkey);
        TRACE("注册热键==%d 
    ",r);
        //注册热键功能
    
    static bool flag=true;
         if (nHotKeyId==111)
         {
            GetParent()->ShowWindow(flag);
             flag=!flag;
         }
        CDialog::OnHotKey(nHotKeyId, nKey1, nKey2);
  • 相关阅读:
    机器学习的数学基础
    Numpy + matplotlib + pandas 用法示例
    笔记:《ZeroMQ》
    Bash 常用快捷键
    Python网络爬虫
    Bash-Script 应用案例
    Bash-Script 语法详解
    ADB的使用
    ROS概述
    架构风格
  • 原文地址:https://www.cnblogs.com/whzym111/p/6224995.html
Copyright © 2020-2023  润新知