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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WM_KEYDOWN

WM_KEYDOWN

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
9 Posts 4 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.
  • U Offline
    U Offline
    unidentify
    wrote on last edited by
    #1

    OnKeyDown(UINT nChar, ...) { char lschar = char(nChar); if (lschar=='A') AfxMessageBox("Key A is pressed"); } In the same way, how to test when key: UPARROW, LEFTARROW, RIGHTARROW, DOWNARROW, NumPad-, NumPad+ is pressed. thanks for help me! don't stop me now!!!

    U 2 T 3 Replies Last reply
    0
    • U unidentify

      OnKeyDown(UINT nChar, ...) { char lschar = char(nChar); if (lschar=='A') AfxMessageBox("Key A is pressed"); } In the same way, how to test when key: UPARROW, LEFTARROW, RIGHTARROW, DOWNARROW, NumPad-, NumPad+ is pressed. thanks for help me! don't stop me now!!!

      U Offline
      U Offline
      ugur_basak
      wrote on last edited by
      #2

      I use an easy method it seems to work. onkeydown(UINT nChar....) { CString string; string.Format("%d",nChar); AfxMessageBox(string); } This func. tells you the code whic you press.

      1 Reply Last reply
      0
      • U unidentify

        OnKeyDown(UINT nChar, ...) { char lschar = char(nChar); if (lschar=='A') AfxMessageBox("Key A is pressed"); } In the same way, how to test when key: UPARROW, LEFTARROW, RIGHTARROW, DOWNARROW, NumPad-, NumPad+ is pressed. thanks for help me! don't stop me now!!!

        2 Offline
        2 Offline
        224917
        wrote on last edited by
        #3

        switch (nChar) { case VK_UP: // up arrow break; case VK_LEFT: // left arrow break; case VK_RIGHT: // right arrow break; case VK_DOWN: // down arrow . . . }


        suhredayan
        There is no spoon.

        T 1 Reply Last reply
        0
        • U unidentify

          OnKeyDown(UINT nChar, ...) { char lschar = char(nChar); if (lschar=='A') AfxMessageBox("Key A is pressed"); } In the same way, how to test when key: UPARROW, LEFTARROW, RIGHTARROW, DOWNARROW, NumPad-, NumPad+ is pressed. thanks for help me! don't stop me now!!!

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          unidentify wrote: onkeydown(UINT nChar, ...) { char lschar = char(nChar); if (lschar=='A') AfxMessageBox("Key A is pressed"); } change this to onkeydown(UINT nChar, ...) { char lschar = char(nChar); if (lschar==VK_UP) AfxMessageBox("Key UP is pressed"); } for rest you can make yourself here is Virtual keycode for them VK_RIGHT VK_DOWN VK_LEFT VK_ADD VK_SUBTRACT cheers, Alok Gupta

          1 Reply Last reply
          0
          • 2 224917

            switch (nChar) { case VK_UP: // up arrow break; case VK_LEFT: // left arrow break; case VK_RIGHT: // right arrow break; case VK_DOWN: // down arrow . . . }


            suhredayan
            There is no spoon.

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            as usual you are always FAST cheers, Alok Gupta

            2 1 Reply Last reply
            0
            • T ThatsAlok

              as usual you are always FAST cheers, Alok Gupta

              2 Offline
              2 Offline
              224917
              wrote on last edited by
              #6

              ThatsAlok wrote: as usual you are always FAST hope you don mind ;)


              suhredayan
              There is no spoon.

              T 1 Reply Last reply
              0
              • 2 224917

                ThatsAlok wrote: as usual you are always FAST hope you don mind ;)


                suhredayan
                There is no spoon.

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                suhredayan® wrote: hope you don mind if you don't mind i will reply that in HINDI "Mind karne ke liye MIND ki jaarorat hoti hian" In English "it require MIND to MIND" cheers, Alok Gupta

                2 1 Reply Last reply
                0
                • T ThatsAlok

                  suhredayan® wrote: hope you don mind if you don't mind i will reply that in HINDI "Mind karne ke liye MIND ki jaarorat hoti hian" In English "it require MIND to MIND" cheers, Alok Gupta

                  2 Offline
                  2 Offline
                  224917
                  wrote on last edited by
                  #8

                  ThatsAlok wrote: "it require MIND to MIND" I thought 'mind' comes as default and free with every package. Is it removed nowadays coz of complaints from 3rd party mind builders ?


                  suhredayan
                  There is no spoon.

                  T 1 Reply Last reply
                  0
                  • 2 224917

                    ThatsAlok wrote: "it require MIND to MIND" I thought 'mind' comes as default and free with every package. Is it removed nowadays coz of complaints from 3rd party mind builders ?


                    suhredayan
                    There is no spoon.

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #9

                    suhredayan® wrote: Is it removed nowadays coz of complaints from 3rd party mind builders ? Yes, testing Deptt Complaint about this! and programmer removed that :->

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta

                    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