If you use MFC, the architecture takes care of routing your events as long as you use what are called Message Maps. You have to tell MFC what function to call when a certain event occurs, and the rest is done by MFC.
For instance, you map a function to an event like File --> Open through the Message Map. Then, when a user of your application triggers the File --> Open event by opening the File menu and choosing Open, the MFC architecture will call the function that you specified in the Map. Of course, the code inside your function can do what's required at that point and has nothing to do with messages anymore.
Here is the Message Map from the Application class (e.g., Lesson1.cpp) of our basic MFC program:
BEGIN_MESSAGE_MAP(CLesson1App, CWinApp)
ON_COMMAND(ID_APP_ABOUT, &CLesson1App::OnAppAbout)
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
You'll see that the File --> Open event is linked to the CWinApp function OnFileOpen() here:
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
You can map an event to any function you like in the Message Map.
Hope that helps. Let me know if you have more questions.
Jenna