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. WM_KEYDOWN on Non-MFC Dialog

WM_KEYDOWN on Non-MFC Dialog

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

    I am trying to find a means for capturing the wm_keydown on a dialog box developed using C++ so that means no MFC, no CDialog, etc. It is the old-fashioned capture of the WM_INITDIALOG, WM_COMMAND, etc. I need to capture a keystroke, determine if it is a specific key, and then perform specific processing. All the information I have been able to find deals with the WM_KEYDOWN on MFC dialog boxes, I haven't been able to find anything in regard to how to handle the messaging if it is a Non-MFC dialog box. Any ideas?

    CPalliniC 1 Reply Last reply
    0
    • A Al_Pennyworth

      I am trying to find a means for capturing the wm_keydown on a dialog box developed using C++ so that means no MFC, no CDialog, etc. It is the old-fashioned capture of the WM_INITDIALOG, WM_COMMAND, etc. I need to capture a keystroke, determine if it is a specific key, and then perform specific processing. All the information I have been able to find deals with the WM_KEYDOWN on MFC dialog boxes, I haven't been able to find anything in regard to how to handle the messaging if it is a Non-MFC dialog box. Any ideas?

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Hint: MSDN is not (only) MFC about, have look at [^] and [^]. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

      In testa che avete, signor di Ceprano?

      A 1 Reply Last reply
      0
      • CPalliniC CPallini

        Hint: MSDN is not (only) MFC about, have look at [^] and [^]. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

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

        I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.

        M CPalliniC 2 Replies Last reply
        0
        • A Al_Pennyworth

          I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark

          "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

          A R 2 Replies Last reply
          0
          • M Mark Salsbery

            Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark

            "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

            A Offline
            A Offline
            Al_Pennyworth
            wrote on last edited by
            #5

            Ah, very true, an obvious point that I have overlooked in this case. I would bet that you are correct, the message is going to one of the controls and not the dialog window.

            1 Reply Last reply
            0
            • A Al_Pennyworth

              I appreciate the suggestions. When I create the window programmatically, the WM_KEYDOWN works like a charm but since this is a dialog box, it doesn't appear to work the same way. As a test, I implemented a WM_KEYDOWN in the dlgProc and it was never captured. I am thinking there is something special that needs to be done to capture the keystroke for a non-mfc dialog box, outside of the standard implementation of the WM_KEYDOWN message.

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              Mark Salsbery hit the target: I saw, with spy tool, WM_KEYDOWN messages going to Dialog OK button! :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              • M Mark Salsbery

                Remember that keystroke events go to the window with keyboard focus. In a dialog that is often one of the controls. Mark

                "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #7

                5 ;)

                Anything I will say you will bring it down to whatever you want.

                - Le Centriste

                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