Win32 API中MK_CONTROL和VK_CONTROL有什么区别?

时间:2014-12-27 12:55:54

标签: c++ winapi

Win32 API中MK_CONTROL和VK_CONTROL有什么区别?

首先,我检查了定义的值。

MK_CONTROL:0x0008 VK_CONTROL:0x11

其次,我在我的简单代码中进行了测试。

case WM_MOUSEMOVE:
    if(wParam & MK_CONTROL)     // This works here.
        abort();
    if(wParam & VK_CONTROL)     // This doesn't work here.
        abort();    

case WM_KEYDOWN:
    if(wParam & MK_CONTROL)     // This doesn't work here.
        abort();
    if(wParam & VK_CONTROL)     // This works here.
        abort();    

case WM_LBUTTONDOWN:
    if(wParam & MK_CONTROL)     // This doens't work here.
        abort();
    if(wParam == VK_CONTROL)    // This doesn't work here.
        abort();

wParam值是否取决于鼠标设备的状态?

MK_ ..和VK_ ..之间的区别是什么?

1 个答案:

答案 0 :(得分:2)

wParam的含义完全取决于您发送的消息。每条消息的文档都会告诉您哪些值对该消息有意义。