zoukankan      html  css  js  c++  java
  • 组合键

    BOOL CtestDlg::PreTranslateMessage(MSG* pMsg)
    {
    // TODO: 在此添加专用代码和/或调用基类
    if(pMsg->message==WM_SYSKEYDOWN)//Alt+?系列热键
    {
    char keyMap[50]="";
    BOOL bAlt=::GetKeyState(VK_MENU)&0x8000;
    if(bAlt)
    {
    if(pMsg->wParam==VK_F4)//屏蔽Alt+F4
    return true;
    else if(((pMsg->wParam>=0x30)&&(pMsg->wParam<=0x39))||((pMsg->wParam>=0x41)&&(pMsg->wParam<=0x5a)))//Alt+?热键(?在0-9,A-Z)
    {
    sprintf(keyMap,"Alt+%c",pMsg->wParam);
    GetDlgItem(IDC_EDIT)->SetWindowTextA(keyMap);
    }
    else
    GetDlgItem(IDC_EDIT)->SetWindowTextA("无");
    }
    else
    GetDlgItem(IDC_EDIT)->SetWindowTextA("无");
    }
    else if(pMsg->message==WM_KEYDOWN)
    {
    BOOL bCtrl=::GetKeyState(VK_CONTROL)&0x8000;
    BOOL bShift=::GetKeyState(VK_SHIFT)&0x8000;
    BOOL bAlt=::GetKeyState(VK_MENU)&0x8000;
    BOOL bHotKey=bCtrl|bShift|bAlt;//判断是否有热键按下
    char keyMap[50]="";
    if(pMsg->wParam==VK_RETURN)//屏蔽回车
    return true;
    else if(pMsg->wParam==VK_ESCAPE)//屏蔽ESC
    return true;
    else if(bHotKey)
    {
    if(((pMsg->wParam>=0x30)&&(pMsg->wParam<=0x39))||((pMsg->wParam>=0x41)&&(pMsg->wParam<=0x5a)))
    {
    if(bCtrl)
    sprintf(keyMap,"%sCtrl+",keyMap);
    if(bShift)
    sprintf(keyMap,"%sShift+",keyMap);
    if(bAlt)
    sprintf(keyMap,"%sAlt+",keyMap);
    sprintf(keyMap,"%s%c",keyMap,pMsg->wParam);
    GetDlgItem(IDC_EDIT)->SetWindowTextA(keyMap);
    }
    else
    GetDlgItem(IDC_EDIT)->SetWindowTextA("无");
    }
    else
    GetDlgItem(IDC_EDIT)->SetWindowTextA("无");
    }

    return CDialog::PreTranslateMessage(pMsg);
    }

  • 相关阅读:
    c/c++ -->对象和类
    zynq基础-->LINUX 设备树
    zynq基础-->yocto
    python3-->基础操作
    构建之法-->概论
    zynq基础-->linux下软件应用
    zynq基础-->系统构架
    网络基础-->http协议
    (转)频谱仪测试pll锁定时间
    modelsim仿真
  • 原文地址:https://www.cnblogs.com/dengpeng1004/p/4986926.html
Copyright © 2011-2022 走看看