Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Hot Keys Of Menu In A Dialog Box

Hot Keys Of Menu In A Dialog Box

Scheduled Pinned Locked Moved C / C++ / MFC
designhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ahmad99
    wrote on last edited by
    #1

    When I add a menu on a Dialog Box....the hot keys of menu did not work although i set the caption of menu item right such as "&Edit...\tCtrl+E". When I do the same work in SDI Appliaction...In single document Application it works fine....but when i made Dialog based application and design menu manually...here it not works..... I have checked the .rc file in SDI and here class wizard added more lines for Hot Keys like IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE BEGIN "N", ID_FILE_NEW, VIRTKEY, CONTROL END I added these lines in .rc of Dialog application but all in vain....any help Have a nice wishes for Helper:-O

    T 1 Reply Last reply
    0
    • A Ahmad99

      When I add a menu on a Dialog Box....the hot keys of menu did not work although i set the caption of menu item right such as "&Edit...\tCtrl+E". When I do the same work in SDI Appliaction...In single document Application it works fine....but when i made Dialog based application and design menu manually...here it not works..... I have checked the .rc file in SDI and here class wizard added more lines for Hot Keys like IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE BEGIN "N", ID_FILE_NEW, VIRTKEY, CONTROL END I added these lines in .rc of Dialog application but all in vain....any help Have a nice wishes for Helper:-O

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      You'll have to override PreTranslateMessage in CYourDlg. Inside the function, call ::TranslateAccelerator.

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

      return CDialog::PreTranslateMessage(pMsg);
      

      }

      Init m_hAccelTable in OnInitDialog - call LoadAccelerators. Tomasz Sowinski -- http://www.shooltz.com

      A 3 Replies Last reply
      0
      • T Tomasz Sowinski

        You'll have to override PreTranslateMessage in CYourDlg. Inside the function, call ::TranslateAccelerator.

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

        return CDialog::PreTranslateMessage(pMsg);
        

        }

        Init m_hAccelTable in OnInitDialog - call LoadAccelerators. Tomasz Sowinski -- http://www.shooltz.com

        A Offline
        A Offline
        Ahmad99
        wrote on last edited by
        #3

        HACCEL LoadAccelerators( HINSTANCE hInstance, // handle to module LPCTSTR lpTableName // accelerator table name ); the prototype of LoadAccelerators is like how i can get lpTableName value....I dont know what to pass in 2nd parametre of function...Thanks foe early help. if u have any chat contact...i want to chat with u ...thanks.

        1 Reply Last reply
        0
        • T Tomasz Sowinski

          You'll have to override PreTranslateMessage in CYourDlg. Inside the function, call ::TranslateAccelerator.

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

          return CDialog::PreTranslateMessage(pMsg);
          

          }

          Init m_hAccelTable in OnInitDialog - call LoadAccelerators. Tomasz Sowinski -- http://www.shooltz.com

          A Offline
          A Offline
          Ahmad99
          wrote on last edited by
          #4

          HACCEL LoadAccelerators( HINSTANCE hInstance, // handle to module LPCTSTR lpTableName // accelerator table name ); the prototype of LoadAccelerators is like how i can get lpTableName value....I dont know what to pass in 2nd parametre of function...Thanks foe early help.

          1 Reply Last reply
          0
          • T Tomasz Sowinski

            You'll have to override PreTranslateMessage in CYourDlg. Inside the function, call ::TranslateAccelerator.

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

            return CDialog::PreTranslateMessage(pMsg);
            

            }

            Init m_hAccelTable in OnInitDialog - call LoadAccelerators. Tomasz Sowinski -- http://www.shooltz.com

            A Offline
            A Offline
            Ahmad99
            wrote on last edited by
            #5

            Chief ....the problem has been solved.....thanks for your help. "VC is an incubus and to tame this monster experience is a mandatory Field."

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups