Modify the Message Loop

To use the accelerator table, you must add the TranslateAccelerator function to the message loop. After you add the function, the message loop should look like this:

while (GetMessage(&msg, NULL, NULL, NULL)) {

if (!TranslateAccelerator(hWnd, hAccTable, &msg)) {

TranslateMessage(&msg);

DispatchMessage(&msg);

}

}