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. Error in loading accelerator table

Error in loading accelerator table

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionlearning
11 Posts 3 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.
  • P Pryabu

    Hi, LoadAccelerators function is returning NULL value. im using the following code: HACCEL m_hAccelTable1; m_hAccelTable1 = LoadAccelerators(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR2)); GetLastError function is returning 1814 error value which states that "The specified resource name cannot be found in the image file". The accelerator table is present in the resource file. Anyone please tell me where i did the mistake? Thanks,

    _ Offline
    _ Offline
    _Superman_
    wrote on last edited by
    #2

    Check if IDR_ACCELERATOR2 is the right value to pass. You could even check if that is the right value by opening the .RC file in text mode.

    «_Superman_»
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

    Polymorphism in C

    P 2 Replies Last reply
    0
    • _ _Superman_

      Check if IDR_ACCELERATOR2 is the right value to pass. You could even check if that is the right value by opening the .RC file in text mode.

      «_Superman_»
      I love work. It gives me something to do between weekends.

      Microsoft MVP (Visual C++)

      Polymorphism in C

      P Offline
      P Offline
      Pryabu
      wrote on last edited by
      #3

      It is there in the resource file: ///////////////////////////////////////////////////////////////////////////// // // Accelerator // IDR_ACCELERATOR2 ACCELERATORS DISCARDABLE BEGIN "V", IDC_BMP_VIEW, VIRTKEY, NOINVERT END

      _ 1 Reply Last reply
      0
      • _ _Superman_

        Check if IDR_ACCELERATOR2 is the right value to pass. You could even check if that is the right value by opening the .RC file in text mode.

        «_Superman_»
        I love work. It gives me something to do between weekends.

        Microsoft MVP (Visual C++)

        Polymorphism in C

        P Offline
        P Offline
        Pryabu
        wrote on last edited by
        #4

        Is it posible to create accelerator keys in a dll?

        S 1 Reply Last reply
        0
        • P Pryabu

          It is there in the resource file: ///////////////////////////////////////////////////////////////////////////// // // Accelerator // IDR_ACCELERATOR2 ACCELERATORS DISCARDABLE BEGIN "V", IDC_BMP_VIEW, VIRTKEY, NOINVERT END

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #5

          Is the accelerator table resource part of the EXE project or any other DLL that the EXE loads?

          «_Superman_»
          I love work. It gives me something to do between weekends.

          Microsoft MVP (Visual C++)

          Polymorphism in C

          P 1 Reply Last reply
          0
          • _ _Superman_

            Is the accelerator table resource part of the EXE project or any other DLL that the EXE loads?

            «_Superman_»
            I love work. It gives me something to do between weekends.

            Microsoft MVP (Visual C++)

            Polymorphism in C

            P Offline
            P Offline
            Pryabu
            wrote on last edited by
            #6

            it is in a dll,but i have added the accelerator table in dll only. Another exe loads it.

            _ 1 Reply Last reply
            0
            • P Pryabu

              Is it posible to create accelerator keys in a dll?

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #7

              Yeah, accelerator tables can be stored in executables (PE files) as resources (if that's what you're asking). In fact it where they're normally stored. They're loaded with the LoadAccelerators[^] function.

              Steve

              1 Reply Last reply
              0
              • P Pryabu

                Hi, LoadAccelerators function is returning NULL value. im using the following code: HACCEL m_hAccelTable1; m_hAccelTable1 = LoadAccelerators(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR2)); GetLastError function is returning 1814 error value which states that "The specified resource name cannot be found in the image file". The accelerator table is present in the resource file. Anyone please tell me where i did the mistake? Thanks,

                S Offline
                S Offline
                Stephen Hewitt
                wrote on last edited by
                #8

                Check the HINSTANCE handle is referring to the correct DLL.

                Steve

                P 1 Reply Last reply
                0
                • P Pryabu

                  it is in a dll,but i have added the accelerator table in dll only. Another exe loads it.

                  _ Offline
                  _ Offline
                  _Superman_
                  wrote on last edited by
                  #9

                  In that case the error is in using the AfxGetInstanceHandle function. Instead use GetModuleHandle with the name of the DLL as parameter.

                  «_Superman_»
                  I love work. It gives me something to do between weekends.

                  Microsoft MVP (Visual C++)

                  Polymorphism in C

                  P 1 Reply Last reply
                  0
                  • _ _Superman_

                    In that case the error is in using the AfxGetInstanceHandle function. Instead use GetModuleHandle with the name of the DLL as parameter.

                    «_Superman_»
                    I love work. It gives me something to do between weekends.

                    Microsoft MVP (Visual C++)

                    Polymorphism in C

                    P Offline
                    P Offline
                    Pryabu
                    wrote on last edited by
                    #10

                    thank u. it is working.

                    1 Reply Last reply
                    0
                    • S Stephen Hewitt

                      Check the HINSTANCE handle is referring to the correct DLL.

                      Steve

                      P Offline
                      P Offline
                      Pryabu
                      wrote on last edited by
                      #11

                      thank u. its working.

                      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