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. how to get the message when the user clicked the uparrow?

how to get the message when the user clicked the uparrow?

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

    I want to dill with the uparrow down message, I tried to use OnKeyDown and OnSysKeyDown ,but when the user pressed the uparrow both of the two function is not called ,why? please help me! thanks a lot!

    P M U 4 Replies Last reply
    0
    • U User 4559

      I want to dill with the uparrow down message, I tried to use OnKeyDown and OnSysKeyDown ,but when the user pressed the uparrow both of the two function is not called ,why? please help me! thanks a lot!

      P Offline
      P Offline
      pr0digy1
      wrote on last edited by
      #2

      I got a very simple solution for you. All you have to do is to add up arrow click to the accelerator table. You can find it in the ResourceView. Specify an ID for the up arrow click and then just click on the View menu and open Class Wizzard. There select which class you want the up arrow message to be processed and then find the ID you wrote in before. In messages double click on COMMAND and that's gonna add a method into your class that gets called every time you click up arrow. hope u get it to work

      1 Reply Last reply
      0
      • U User 4559

        I want to dill with the uparrow down message, I tried to use OnKeyDown and OnSysKeyDown ,but when the user pressed the uparrow both of the two function is not called ,why? please help me! thanks a lot!

        P Offline
        P Offline
        pr0digy1
        wrote on last edited by
        #3

        I got a very simple solution for you. All you have to do is to add up arrow click to the accelerator table. You can find it in the ResourceView. Specify an ID for the up arrow click and then just click on the View menu and open Class Wizzard. There select which class you want the up arrow message to be processed and then find the ID you wrote in before. In messages double click on COMMAND and that's gonna add a method into your class that gets called every time you click up arrow. hope u get it to work

        1 Reply Last reply
        0
        • U User 4559

          I want to dill with the uparrow down message, I tried to use OnKeyDown and OnSysKeyDown ,but when the user pressed the uparrow both of the two function is not called ,why? please help me! thanks a lot!

          M Offline
          M Offline
          Masaaki Onishi
          wrote on last edited by
          #4

          Hello, Codeguru. I used to have the same problem a long time ago, but I did't remeber how to fix this problem so well.. But, 1) We can use PreTranslateMessage funnction in the dialog, and this function catches all message of the keystorke or mouse event before the message dispatches to each control. And, try to use CWnd* GetFocus() to check whether the up-arrow message is sure for the control which you want to check. 2) OnKeyDown function of each control may be called in subclassed derived class of each control. That is, we derived from the new class from each control class, and the message will be catched inside this class, and OnKeyDown will works. Since I didn't find these codes in my old project, I'm not sure these works. But, PreTranslateMessage function will works more than 2) HTH. -Masaaki Onishi-

          1 Reply Last reply
          0
          • U User 4559

            I want to dill with the uparrow down message, I tried to use OnKeyDown and OnSysKeyDown ,but when the user pressed the uparrow both of the two function is not called ,why? please help me! thanks a lot!

            U Offline
            U Offline
            User 4315
            wrote on last edited by
            #5

            Actually all you have to do is catch the WM_KEYUP event. Just go to classWizard, select the class you like to handle the event, and then choose WM_KEYUP from the message entries. Then, choose add function, and finally choose edit code. Then try AfxMessageBox(" up pressed"), and that will tell you if you were able to catch it or not. It worked for me, so I am sure it will for you. I tried the suggestion of adding the ID to the accelerator table but that didn't work. If you got it to work, I would be interested in how you did it. sayed hashimi

            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