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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Key accelerators

Key accelerators

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
2 Posts 2 Posters 1 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.
  • B Offline
    B Offline
    BoudewijnEctor
    wrote on last edited by
    #1

    Hi, I've made a key accelerator for my program (I did it by using the resource view), and I want to 'attach' it to my windows. How can I make sure that the accelerator table is associated with the window? Thanks

    M 1 Reply Last reply
    0
    • B BoudewijnEctor

      Hi, I've made a key accelerator for my program (I did it by using the resource view), and I want to 'attach' it to my windows. How can I make sure that the accelerator table is associated with the window? Thanks

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      If you're using MFC, and the window in question is a frame window (derived from CFrameWnd), it already has support for accelerators. To make the frame window load the accelerator table at the same time as the menu and other resources, give it the same resource ID as the menu and use LoadFrame to create the frame window. If you want an alternate set of accelerators, use LoadAccelTable. For a non-CFrameWnd window, you'll need to call LoadAccelerators to load the table, and insert a call to TranslateAccelerator in an override of PreTranslateMessage, returning TRUE if TranslateAccelerator does. I don't know enough WTL to offer a suggestion. If you're using the raw Win32 API, insert a call to TranslateAccelerator before your call to TranslateMessage in your message loop.

      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