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. trap a-z keys!!!

trap a-z keys!!!

Scheduled Pinned Locked Moved C / C++ / MFC
help
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.
  • X Offline
    X Offline
    xxhimanshu
    wrote on last edited by
    #1

    :confused:Hi all, I want to trap keys through A to Z I am using VK_A to VK_Z. but it does not recognize it at all.. is there any other way of doing it.. Please I need to do it..Any help and pointers are thoroughly appreciated.. Thanks in advance.. Himanshu

    M M 2 Replies Last reply
    0
    • X xxhimanshu

      :confused:Hi all, I want to trap keys through A to Z I am using VK_A to VK_Z. but it does not recognize it at all.. is there any other way of doing it.. Please I need to do it..Any help and pointers are thoroughly appreciated.. Thanks in advance.. Himanshu

      M Offline
      M Offline
      Mil10
      wrote on last edited by
      #2

      Not clear from where u want to trap the keys. if it is from ur app dialog just use ON_WM_KEYDOWN - OnKeyDown msg handler. Otherwise, if u want system wide key trap , see documentaion of the API SetWindowsHookEx. Best wishes..mil10

      1 Reply Last reply
      0
      • X xxhimanshu

        :confused:Hi all, I want to trap keys through A to Z I am using VK_A to VK_Z. but it does not recognize it at all.. is there any other way of doing it.. Please I need to do it..Any help and pointers are thoroughly appreciated.. Thanks in advance.. Himanshu

        M Offline
        M Offline
        Mathias S
        wrote on last edited by
        #3

        Like it says in winuser.h /* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */ /* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */ Example...

        void CMyCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
        {
        if( nChar == 'A' )
        {
        // Do Stuff
        }
        }

        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