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. Routing Enter/Return key press to a Dialog

Routing Enter/Return key press to a Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 Posts 4 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.
  • D Offline
    D Offline
    dipuks
    wrote on last edited by
    #1

    Hey I have a MFC dialog app that will process the Enter/Return key presses in the keyboard. Now if the dialog is minimized or hidden behind some other window, it will not be able to process the Return key presses. Which makes sense considering the keyboard messages are routed to the window with focus. I want to route all Return/Enter key presses to my MFC dialog irrespective of whether its hidden or minimized. Is there a way i can do that? Thanks in advance.

    A A D 3 Replies Last reply
    0
    • D dipuks

      Hey I have a MFC dialog app that will process the Enter/Return key presses in the keyboard. Now if the dialog is minimized or hidden behind some other window, it will not be able to process the Return key presses. Which makes sense considering the keyboard messages are routed to the window with focus. I want to route all Return/Enter key presses to my MFC dialog irrespective of whether its hidden or minimized. Is there a way i can do that? Thanks in advance.

      A Offline
      A Offline
      Abhi Lahare
      wrote on last edited by
      #2

      Use Keyboard hooks.

      D 1 Reply Last reply
      0
      • D dipuks

        Hey I have a MFC dialog app that will process the Enter/Return key presses in the keyboard. Now if the dialog is minimized or hidden behind some other window, it will not be able to process the Return key presses. Which makes sense considering the keyboard messages are routed to the window with focus. I want to route all Return/Enter key presses to my MFC dialog irrespective of whether its hidden or minimized. Is there a way i can do that? Thanks in advance.

        A Offline
        A Offline
        Albert Holguin
        wrote on last edited by
        #3

        Are you sure you want to do this? ...this sounds like it would create a headache for your users...

        1 Reply Last reply
        0
        • A Abhi Lahare

          Use Keyboard hooks.

          D Offline
          D Offline
          dipuks
          wrote on last edited by
          #4

          Yes i want to do this, as this is just a sample app. What kinda keyboard hooks? Any particular function that i can use? Any example code?

          A 1 Reply Last reply
          0
          • D dipuks

            Hey I have a MFC dialog app that will process the Enter/Return key presses in the keyboard. Now if the dialog is minimized or hidden behind some other window, it will not be able to process the Return key presses. Which makes sense considering the keyboard messages are routed to the window with focus. I want to route all Return/Enter key presses to my MFC dialog irrespective of whether its hidden or minimized. Is there a way i can do that? Thanks in advance.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            dipuks wrote:

            I want to route all Return/Enter key presses to my MFC dialog irrespective of whether its hidden or minimized.
             
            Is there a way i can do that?

            Why would you want/need to do this? After capturing them, are you planning on passing those keystrokes on so that the window with focus will behave as expected?

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather

            1 Reply Last reply
            0
            • D dipuks

              Yes i want to do this, as this is just a sample app. What kinda keyboard hooks? Any particular function that i can use? Any example code?

              A Offline
              A Offline
              Abhi Lahare
              wrote on last edited by
              #6

              HTH KeyBoard Hooks[^] on side note, you are making your system unstable by using hooks. and as inputs from others posters you are changing default functionality of other application.

              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