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. about the keyboard events

about the keyboard events

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

    I'm working on sending keyboard events from my code using Visual C++.Now I can send keyborad events using the fuction "keybd_event". for example: char pChar = 'a'; SHORT ks = VkKeyScan(pChar); BYTE key = ks & 0xFF; keybd_event(key,0,0,0); sends an message as if I pressed the button 'a' The scan code '0x61' stands for the key 'a' on the keyboard,what about the code of the combination of 'Alt+a' or 'ctrl+a'? I would like to know what are the scan codes that stand for two key combinations of the keyboard. Or is this any other way to send such information from my code? Thanks a lot!

    C 1 Reply Last reply
    0
    • R Ray

      I'm working on sending keyboard events from my code using Visual C++.Now I can send keyborad events using the fuction "keybd_event". for example: char pChar = 'a'; SHORT ks = VkKeyScan(pChar); BYTE key = ks & 0xFF; keybd_event(key,0,0,0); sends an message as if I pressed the button 'a' The scan code '0x61' stands for the key 'a' on the keyboard,what about the code of the combination of 'Alt+a' or 'ctrl+a'? I would like to know what are the scan codes that stand for two key combinations of the keyboard. Or is this any other way to send such information from my code? Thanks a lot!

      C Offline
      C Offline
      Christian
      wrote on last edited by
      #2

      The 'other' keys, like arrows, alt, etc. all have VK codes, such as VK_LEFT and VK_ALT. I *suspect* you could add these values to the values of keys, that they each set a high bit. This is just a guess, but hopefully will put you on the right track.

      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