title: WinAPI - Menu accelerators not working
body: <p>I'm trying to add accelerators to my menu, when I press 'Ctrl+R' it should send the command <code>ID_VIEW_RESULTS</code>, But it doesn't. It works fine clicking the menu item, but it isn't translating the accelerator, this is what I have:</p>
  
  <p>MyApp.h</p>
  
  <pre><code>#define WIN32_LEAN_AND_MEAN
  #include &lt;Windows.h&gt;
  
  #define ID_MAINMENU 101
  #define ID_MENUACC  102
  
  #define ID_VIEW_RESULTS 2001
  </code></pre>
  
  <p>MyApp.rc</p>
  
  <pre><code>#include "MyApp.h"
  
  /////////////////////////////////////////////////////////////////////////////
  //
  // Menu
  //
  
  ID_MAINMENU MENU 
  BEGIN
      POPUP "&amp;View"
      BEGIN
          MENUITEM "Calculated &amp;Results...\aCtrl+R",  ID_VIEW_RESULTS
      END
  END
  
  /////////////////////////////////////////////////////////////////////////////
  //
  // Accelerator
  //
  
  ID_MENUACC ACCELERATORS 
  BEGIN
      "^R",       ID_VIEW_RESULTS,        ASCII,  NOINVERT
  END
  </code></pre>
  
  <p>MyApp.cpp</p>
  
  <pre><code>#include "MyApp.h"
  
  int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow)
  {
      UNREFERENCED_PARAMETER(hPrevInst);
      UNREFERENCED_PARAMETER(lpCmdLine);
  
      // Create and show main window, CMainWnd definition is dialog
      // resource template, works fine, irrelevant to problem.
      MainWnd = new CMainWnd();
      MainWnd-&gt;Show();
  
      MSG    Msg;
      HACCEL hAcc;
      hAcc = LoadAccelerators(hInst, MAKEINTRESOURCE(ID_MENUACC));
  
      while (GetMessage(&amp;Msg, 0, 0, 0)) {
          if (!TranslateAccelerator(Msg.hwnd, hAcc, &amp;Msg)) {
              TranslateMessage(&amp;Msg);
              DispatchMessage(&amp;Msg);
          }
      }
  
      return (int)Msg.wParam;
  }
  </code></pre>
  
  <p>I myself can't see a good reason why this wouldn't work, can anyone point out what I'm doing wrong or give me any suggestions?</p>