Hi, take a look at this:

LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Route all Windows messages to the game engine
return GameEngine::GetEngine()->HandleEvent(hWindow, msg, wParam, lParam);
}

Here i am routing windows messages to my game engine so that HandleEvent can be the function to process the messagess. My question is:

I dont quite understand how returning HandleEvent(hWindow, msg, wParam, lParam); to WndProc() routes windows messages to the HandleEvent() function, could you explain to me how windows reads this code so that it routes the messages?