如何将-1传递给MAKEWPARAM并使用HIWORD返回-1?

时间:2017-01-29 20:02:41

标签: mfc

拿这段代码:

WPARAM eTypes[] = 
{
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Sound, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_PlatformAttendant, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Mike, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Attendant, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_OCLM, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_ConductorCBS, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_ReaderCBS, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Chairman, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Prayer, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Student, -1),
    MAKEWPARAM(MSAToolsLibrary::AssignmentType_Demonstration, -1)

};

for (int a = 0; a < 11; a++)
{
    WORD l = LOWORD(eTypes[a]);
    WORD h = HIWORD(eTypes[a]);
    CString s;
    s.Format(_T("%d %d"), l, h);
    AfxMessageBox(s);

}

AssignmentType值为long常量。

AfxMessageBox产生65535,我知道它是整数的无符号值(我认为)。但我不想要值65535.我想要-1回(如果确实是-1)。它也可能是其他一些价值。

那么我该怎么做-1并且得到-1而不是65535回来?

0 个答案:

没有答案