Shurik
Shurik

Reputation: 67

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.

Upvotes: 1

Views: 2944

Answers (1)

paxdiablo
paxdiablo

Reputation: 881463

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.

Upvotes: 1

Related Questions