Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7976669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:58:14+00:00 2026-06-04T08:58:14+00:00

I found this link: http://support.microsoft.com/kb/222829 But I can’t understand that much. Ok, I understood

  • 0

I found this link: http://support.microsoft.com/kb/222829

But I can’t understand that much.

Ok, I understood I need to add this to my header file:

HACCEL  m_hAccelTable;

and then this:

m_hAccelTable = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR1));

to my main .cpp

But where does this go?

BOOL CAboutDlg::PreTranslateMessage(MSG* pMsg) {
   if (m_hAccelTable) {
      if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg)) {
         return(TRUE);
      }
   }
   return CDialog::PreTranslateMessage(pMsg);

}

I need around 6 shortcuts (CTRL + U to load something, CTRL + O to load smth else), I can’t understand how this works, need a little bit of help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:58:16+00:00Added an answer on June 4, 2026 at 8:58 am

    Now, MSDN article is misleading. It shows how to add accelerators to About box and only About box will be able to handle accelerator that is in this case equivalent of pressing the button with IDC_BUTTON1 ID.

    You need to do something very different allowing all objects in your application to get a chance to handle this message. This is done for you in MDI/SDI apps.

    Once you create accelerator table in the resource, you have to add accelerators: Key combination paired Accelerator key combination, when used generates command message with appropriate ID. Once you are done adding, you have to create command message handlers for each of the ID.
    When accelerator is used the handler is invoked and you can add the code you need.
    Now do this:
    Declare HACCEL type variable to your app class. In the InitInstance call LoadAccelerators.
    Use wizard to insert PreTranslateMessage override in your application class. Add following:

          if (m_hAccelTable) 
          {
                    if (::TranslateAccelerator(*m_pMainWnd, m_hAccelTable, pMsg)) 
                    {
                              return(TRUE);
                    }
          }
    

    This will allow the main dialog to handle accelerators. Note *m_pMainWnd. It is your dialog handle (automatically casted).
    Now you can add handlers for any accelerator to the dialog or to the application class. You can also route command messages to any window in your application using OnCmdMsg.

    My advice for the future.
    When you decide to make your app a dialog based, consider creating SDI application with CFormView derived class.
    You can change frame style to not allow resizing and it will look like dialog based but. . .
    You will have ability to use a toolbar a menu for free and most importantly you will have all accelerator and command routing for free.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this link http://smartclient.codeplex.com/ which has some updates for vs 2010 ....
I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/ , but there isn't a lot of description around
I found this question that is discussing what I would like to do, but
I found this link on how to embed custom fonts in XAML apps. Is
i have a problem using the Catch Clipboard Events code found on this link
I've found a code which opens this link after logging in to google account
Found this: Sub SurroundWithAppendTag() DTE.ActiveDocument.Selection.Text = .Append( + DTE.ActiveDocument.Selection.Text + ) End Sub But
found this regex: insert every 10 characters: $text = preg_replace(|(.{10})|u, \${1}. , $text); can
Found this question that explained a way to communicate between layers. However there is
I have outbound links like this in my html: <a href=http://www.example.com class=gaLink1 target=_blank onCLick=ga_track_link('action',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.