Ctrl + 1和Ctrl + 3在PreTranslateMessage中不起作用 [英] Ctrl+1 and Ctrl+3 not working in PreTranslateMessage

查看:74
本文介绍了Ctrl + 1和Ctrl + 3在PreTranslateMessage中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if(  pMsg->wParam == WM_KEYDOWN || pMsg->message == WM_KEYDOWN )
    {
        if ( GetKeyState( VK_CONTROL ) < 0 )
        {
            // Ctrl+0
            else if( pMsg->wParam == 48 || pMsg->wParam == VK_NUMPAD0 )
            {
                AfxMessageBox("CTRL+0");
                return TRUE;
            }
            // Ctrl+1
            else if( pMsg->wParam == 49 || pMsg->wParam == VK_NUMPAD1 )
            {
                AfxMessageBox("CTRL+1");
                return TRUE;
            }
            // Ctrl+2
            else if( pMsg->wParam == 50 || pMsg->wParam == VK_NUMPAD2 )
            {
                AfxMessageBox("CTRL+2");
                return TRUE;
            }
            // Ctrl+3
            else if( pMsg->wParam == 51 || pMsg->wParam == VK_NUMPAD3 )
            {
                AfxMessageBox("CTRL+3");
                return TRUE;
            }
            // Ctrl+4
            else if( pMsg->wParam == 52 || pMsg->wParam == VK_NUMPAD4 )
            {
                AfxMessageBox("CTRL+4");
                return TRUE;
            }
        }
    }



在上面的代码中,NUMPAD1和NUMPAD3不起作用.
请让我知道还有其他方法可以实现此目的.



In the above code NUMPAD1 and NUMPAD3 is not working.
Please let me know is any other way to make this work.

推荐答案

否则if 而没有 if ?我不确定这是否可以编译.还是您在此处错误地粘贴了代码?
else if with out if? I am not sure if this will compile. Or did you paste the code wrongly here?


验证您是否已启用NUMLOCK.
Verify that you have NUMLOCK on.


这篇关于Ctrl + 1和Ctrl + 3在PreTranslateMessage中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆