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. get keyboard events

get keyboard events

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 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
    Willem B
    wrote on last edited by
    #1

    hi, maybe a dumbquestion... :omg: i want to know wenn a key is pressed in my dialog and witch key is pressed. how do i do it? thanks in advanced... Willem []D [] []D []

    M H 2 Replies Last reply
    0
    • W Willem B

      hi, maybe a dumbquestion... :omg: i want to know wenn a key is pressed in my dialog and witch key is pressed. how do i do it? thanks in advanced... Willem []D [] []D []

      M Offline
      M Offline
      Michael Shuster
      wrote on last edited by
      #2

      If you go into the Class Wizard under the message maps tab you can select WM_KEYDOWN or WM_KEYUP from the messages section. Once selected add a function to the event and edit the code in the function. The function takes in a parmeter called nChar. convert nChar to a regualr character by using something like char myChar; myChar = char(nChar); then to find what key was pressed you can do simple comparisons like if (myChar =='A') { } Michael Shuster Good Judgement comes from experience; Experience comes from bad judgement.

      1 Reply Last reply
      0
      • W Willem B

        hi, maybe a dumbquestion... :omg: i want to know wenn a key is pressed in my dialog and witch key is pressed. how do i do it? thanks in advanced... Willem []D [] []D []

        H Offline
        H Offline
        HENDRIK R
        wrote on last edited by
        #3

        tracking WM_KEYDOWN should do it. There's much information about it on MSDN.

        W 1 Reply Last reply
        0
        • H HENDRIK R

          tracking WM_KEYDOWN should do it. There's much information about it on MSDN.

          W Offline
          W Offline
          Willem B
          wrote on last edited by
          #4

          Hi, if tried it and it didn't work, maybe i should add that i want to override the input of inputbox to make my user interfase more keyboard-based. []D [] []D []

          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