Jenix
Jenix

Reputation: 3076

What is the difference between MK_CONTROL and VK_CONTROL in Win32 API?

What is the difference between MK_CONTROL and VK_CONTROL in Win32 API?

Firstly, I checked the defined values.

MK_CONTROL : 0x0008 VK_CONTROL : 0x11

Secondly, I tested in my simple code like this.

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();

Does wParam value depend on the state of mouse device?

What is the difference between MK_.. and VK_.. thing?

Upvotes: 1

Views: 2914

Answers (1)

Alan Stokes
Alan Stokes

Reputation: 18974

The meaning of wParam depends entirely on which message you have been sent. The documentation for each message tells you which values are meaningful for that message.

Upvotes: 1

Related Questions