简体   繁体   中英

C++ Visual Studio Error: IntelliSense: expected a statement

while (!GetAsyncKeyState(VK_INSERT)) //VK_INSERT = Insert key on numpad
{

    if (clock() - GameAvailTMR > 100)
    {
        GameAvailTMR = clock();
        IsGameAvail = false;

        hGameWindow = FindWindow(NULL, LGameWindow);
        if (hGameWindow)
        {
            GetWindowThreadProcessId(hGameWindow, &dwProcID);
            if (dwProcID != 0)
            {
                hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
                if (hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL);
                {
                    GameStatus = "Faild to open process for value handle";
                }
                else
                {
                    GameStatus = "AssaultCube Ready To Hack";
                    IsGameAvail = true;
                }


            }
        }
    }

}

On my visual studio IDE the else statement is underlined red and the error "IntelliSense: expected a statement" pops up. I'm on Visual Studio 2013 if that matters.

Take the semicolon off this line:

if (hProcHandle == INVALID_HANDLE_VALUE || ...);

It's terminating the if statement so that there's a valid block afterwards (which would execute regarless of the if statement):

{
    // some valid statements
}

followed by a very invalid, "naked" else .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM