VanPers
VanPers

Reputation: 339

error: LOWORD undeclared

I meet that problem:

LOWORD undeclared

with this piece of code:

case WM_COMMAND:
        {
            if (lParam==0)
            {
                if ((LOWORD)wParam==IDM_HELLO)
                   MessageBox(0, L"Hello", (LPCSTR)szClassName, MB_OK);
            }
        break;
        }

I don't know what I loss. Anyone help me?

Upvotes: 1

Views: 514

Answers (1)

Andy
Andy

Reputation: 30418

LOWORD is not a type that you cast a variable to, but a macro to extract the lower 16 bits of a 32-bit value. Your code will probably compile if you change it to this:

case WM_COMMAND:
{
    if (lParam==0)
    {
        if (LOWORD(wParam) == IDM_HELLO)
        {
            MessageBox(0, L"Hello", (LPCSTR)szClassName, MB_OK);
        }
    }
    break;
 }

Upvotes: 2

Related Questions