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. handling accelerator

handling accelerator

Scheduled Pinned Locked Moved C / C++ / MFC
3 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.
  • R Offline
    R Offline
    Rage
    wrote on last edited by
    #1

    Hi ! I have a SDI app, where I have defined an accelerator for the F3 key. In this app, I have a dialog window opened all the time, and i need the accelerator to be effective, even when the focus is on the dialog. I have tried to handle the VF_KEY (heu .. i am not sure about the name .. anyway, it is the "key message") in my dialog, and i then send post a message to the mainframe. Is there a better way to do it (because this one does not always work properly, sometimes the function is called twice, sometimes it is not handled by the overrided key function in the dialog). The function is supposed to toggle the dialog (enabling or disabling its being showed). ~RaGE();

    E A 2 Replies Last reply
    0
    • R Rage

      Hi ! I have a SDI app, where I have defined an accelerator for the F3 key. In this app, I have a dialog window opened all the time, and i need the accelerator to be effective, even when the focus is on the dialog. I have tried to handle the VF_KEY (heu .. i am not sure about the name .. anyway, it is the "key message") in my dialog, and i then send post a message to the mainframe. Is there a better way to do it (because this one does not always work properly, sometimes the function is called twice, sometimes it is not handled by the overrided key function in the dialog). The function is supposed to toggle the dialog (enabling or disabling its being showed). ~RaGE();

      E Offline
      E Offline
      eXplodus
      wrote on last edited by
      #2

      you should be watch what you send after you handle the message. the first time you hook into the message, handle it. then "delete" it. so that no other window handle the message again.

      1 Reply Last reply
      0
      • R Rage

        Hi ! I have a SDI app, where I have defined an accelerator for the F3 key. In this app, I have a dialog window opened all the time, and i need the accelerator to be effective, even when the focus is on the dialog. I have tried to handle the VF_KEY (heu .. i am not sure about the name .. anyway, it is the "key message") in my dialog, and i then send post a message to the mainframe. Is there a better way to do it (because this one does not always work properly, sometimes the function is called twice, sometimes it is not handled by the overrided key function in the dialog). The function is supposed to toggle the dialog (enabling or disabling its being showed). ~RaGE();

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

        i am assuming that the dialog is modeless ? just to give you somewhere to start looking CWinApp::Run() and maybe IsDialogMessage() TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver. If applications process virtual-key messages for some other purpose, they should not call TranslateMessage. For instance, an application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value.

        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