Thread: Keyboard accelerator issues

  1. #1
    Registered User
    Join Date
    Jun 2008

    Keyboard accelerator issues

    Ok, I'm using multiple dialogs and I want to have keyboard shortcuts that are exclusive to specific dialogs instead of the whole thing. Can multiple accelerators be used? I'm not having much luck getting the desired functionality & flexibility or finding decent examples of rigging this type of behavior. I think I'd like to handle it from the message loop within WinMain. I'm just not sure how. Maybe if I kept a global with the handle to each procedure I could compare that tot he one in the message struct when retrieving and dispatching messages. My main issue is getting one accelerator to run only when a certain dialog or it's children has focus. I want to make this main dialog a portable interface to be called up from other dialogs when inserted into certain other projects while having an easy way to override the default accelerator(s) in favor of the ones intended for the dialog.
    Last edited by Viper187; 09-01-2008 at 07:46 PM.

  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    Alot depends on your app.

    How many windows are we talking about?
    How often will focus change?
    How important is speed or system resource use?

    You could create (or load) individual an acc table for each window, after destroying the current one on change of focus etc.
    Not the best soloution for an app with lots of windows or rapidly changing focus apps.

    You could filter all messages at the TranslateAccelerator level (based on the hWnd param?)
    WM_COMMAND messages can be filtered using the wParam.
    Will slow the app down or use more resources.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jun 2008
    I guess I'll probably try doing it at the TranslateAccelerator level. If I can keep it simple enough, hopefully there won't be any major hit to speed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting keyboard and mouse in linux
    By sameer.nalwade in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 04:24 AM
  2. Keyboard port using other that a keyboard
    By antoinelac in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2008, 02:46 PM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM
  5. : Difference between message queue and keyboard buffer...
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 02-21-2002, 03:47 PM