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. PreTranslateMessage, how to check key combination like Ctrl+R

PreTranslateMessage, how to check key combination like Ctrl+R

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

    Hi, in my dialog the users want to change focus not by using the tab-key, instead they want to jump directly to the different controls using accelerators. Therefor i want to check the key combination in the PreTranslateMessage method, to set the focus. How can i check this, because i always get only one key in the pMsg->wParam variable and not the combination. Need some advise or another solution. TIA, Chris

    K M 2 Replies Last reply
    0
    • C Chris Vischer

      Hi, in my dialog the users want to change focus not by using the tab-key, instead they want to jump directly to the different controls using accelerators. Therefor i want to check the key combination in the PreTranslateMessage method, to set the focus. How can i check this, because i always get only one key in the pMsg->wParam variable and not the combination. Need some advise or another solution. TIA, Chris

      K Offline
      K Offline
      Kurt 0
      wrote on last edited by
      #2

      if (0 > GetKeyState(VK_MENU)) ALT Key down if (0 > GetKeyState(VK_CONTROL)) CTRL Key down and so on Kurt

      1 Reply Last reply
      0
      • C Chris Vischer

        Hi, in my dialog the users want to change focus not by using the tab-key, instead they want to jump directly to the different controls using accelerators. Therefor i want to check the key combination in the PreTranslateMessage method, to set the focus. How can i check this, because i always get only one key in the pMsg->wParam variable and not the combination. Need some advise or another solution. TIA, Chris

        M Offline
        M Offline
        Mike Dunn
        wrote on last edited by
        #3

        Chris, this is a built-in feature of dialogs and doesn't require any code on your part. Just create a static control and put it next to the edit box, e.g.: P&rice: [edit box here] The &r will show up on the screen as an underlined "r". Make sure the static is right before the edit box in the tab order, and then pressing Alt-R will move the focus to the edit box. If you *really* have to support shortcut keys using Ctrl, not Alt, then you will have to do some code. But using Alt has been standard for years, so go with Alt.

        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