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. OnKeyUp()

OnKeyUp()

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 5 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
    Anu_Bala
    wrote on last edited by
    #1

    hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....

    Anu

    CPalliniC N 2 Replies Last reply
    0
    • A Anu_Bala

      hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....

      Anu

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

      Well, as stated by the documentation [^], the nChar argument passed to the OnKeyUp() handler, is the virtual key code of the given key, hence it isn't its ASCII code. The fact that the two quantities are the same for numeric (and for letters 'A' to 'Z') keys is a mere (well, not casual, and useful ;) ) coincidence. Anyway the ultimate reference for virtual key codes is (again documentation states it) the Winuser.h header file :)

      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.
      [my articles]

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • A Anu_Bala

        hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....

        Anu

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        try WM_CHAR instead of WM_KEYUP.

        nave [OpenedFileFinder]

        N A 2 Replies Last reply
        0
        • N Naveen

          try WM_CHAR instead of WM_KEYUP.

          nave [OpenedFileFinder]

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          It's right, but it is sent when the key is down. He may be demanding the "key up" itself.

          - NS - [ODBaseBtn]

          1 Reply Last reply
          0
          • N Naveen

            try WM_CHAR instead of WM_KEYUP.

            nave [OpenedFileFinder]

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

            I used WM_CHAR but when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar(). What can i do for that? I need to find ASCII fro combination of two keys like Ctrl-F1,ctrl-F2..like that.

            Anu

            N 1 Reply Last reply
            0
            • A Anu_Bala

              I used WM_CHAR but when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar(). What can i do for that? I need to find ASCII fro combination of two keys like Ctrl-F1,ctrl-F2..like that.

              Anu

              N Offline
              N Offline
              Naveen
              wrote on last edited by
              #6

              Anu_Bala wrote:

              when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar().

              WM_CHAR message will not be raised for such type keys like functions keys, page up, page down, home, end etc. If you want to handle such keys also then you have to use the WM_KEYUP/WM_KEYDOWN itself. If you are handling the message in the WM_KEYUP/WM_KEYDOWN, check the nchar aganist the values like VK_OEM_4 for '[' and '{' , VK_OEM_6 for ']' and '}' . Check the winuser.h for all the virtual key codes.

              nave [OpenedFileFinder]

              F 1 Reply Last reply
              0
              • N Naveen

                Anu_Bala wrote:

                when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar().

                WM_CHAR message will not be raised for such type keys like functions keys, page up, page down, home, end etc. If you want to handle such keys also then you have to use the WM_KEYUP/WM_KEYDOWN itself. If you are handling the message in the WM_KEYUP/WM_KEYDOWN, check the nchar aganist the values like VK_OEM_4 for '[' and '{' , VK_OEM_6 for ']' and '}' . Check the winuser.h for all the virtual key codes.

                nave [OpenedFileFinder]

                F Offline
                F Offline
                Florin Crisan
                wrote on last edited by
                #7

                Why not just use keyboard accelerators[^]?

                Florin Crisan

                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