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. trapping keyboard message

trapping keyboard message

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++lounge
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.
  • W Offline
    W Offline
    will1383
    wrote on last edited by
    #1

    Hi All, I have an MFC dialog App that has several controls in it, including a bunch of Edit boxes. What I'd like to do is trap the "Enter" key message from each of these edit boxes in order to do some special processing. How do I do this in an MFC App? I'd like to get the event from that control instead of just trapping a general keyboard message and then having to determine which key was pressed and which control has the focus. Any suggestions? Thanks! Dan

    L I 2 Replies Last reply
    0
    • W will1383

      Hi All, I have an MFC dialog App that has several controls in it, including a bunch of Edit boxes. What I'd like to do is trap the "Enter" key message from each of these edit boxes in order to do some special processing. How do I do this in an MFC App? I'd like to get the event from that control instead of just trapping a general keyboard message and then having to determine which key was pressed and which control has the focus. Any suggestions? Thanks! Dan

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Maybe you need to handle PreTranslateMessage. If you subclass the control, have a look at WM_GETDLGCODE.

      1 Reply Last reply
      0
      • W will1383

        Hi All, I have an MFC dialog App that has several controls in it, including a bunch of Edit boxes. What I'd like to do is trap the "Enter" key message from each of these edit boxes in order to do some special processing. How do I do this in an MFC App? I'd like to get the event from that control instead of just trapping a general keyboard message and then having to determine which key was pressed and which control has the focus. Any suggestions? Thanks! Dan

        I Offline
        I Offline
        imsniper
        wrote on last edited by
        #3

        CEdit is a CWnd object maybe you can Overide afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );

        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