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. OnKeyDown event not working ?

OnKeyDown event not working ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpcomtutorialquestion
5 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.
  • A Offline
    A Offline
    Amarelia
    wrote on last edited by
    #1

    Hi I have developed a custom banner using CBannerStatic class and source file give at "http://www.codeproject.com/staticctrl/bannerstatic2.asp" Now the problem is it terminates when I press ESC or spacebar. I want to use a different key combination to terminate, like say Ctrl+Alt+A or simply say "Ctrl + Q". For that I used OnKeyDown() and put the WM_KEYDWON event in message map but it's not working. I have also used OnChar() and same way WM_CHAR but still it's not working.... Any idea or any help how to overcome this ? Regards, Amarelia Maehsh Gujarat India

    K M 2 Replies Last reply
    0
    • A Amarelia

      Hi I have developed a custom banner using CBannerStatic class and source file give at "http://www.codeproject.com/staticctrl/bannerstatic2.asp" Now the problem is it terminates when I press ESC or spacebar. I want to use a different key combination to terminate, like say Ctrl+Alt+A or simply say "Ctrl + Q". For that I used OnKeyDown() and put the WM_KEYDWON event in message map but it's not working. I have also used OnChar() and same way WM_CHAR but still it's not working.... Any idea or any help how to overcome this ? Regards, Amarelia Maehsh Gujarat India

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      I think you are using it in your dialog box. So all keys pressed go to the parent window. In this case it is going to the Cancel or OK button, so the application exits. You need to handle your particular key combination e.g, Ctrl + Q etc for the main dialog using accelerators. this is this.

      A 1 Reply Last reply
      0
      • A Amarelia

        Hi I have developed a custom banner using CBannerStatic class and source file give at "http://www.codeproject.com/staticctrl/bannerstatic2.asp" Now the problem is it terminates when I press ESC or spacebar. I want to use a different key combination to terminate, like say Ctrl+Alt+A or simply say "Ctrl + Q". For that I used OnKeyDown() and put the WM_KEYDWON event in message map but it's not working. I have also used OnChar() and same way WM_CHAR but still it's not working.... Any idea or any help how to overcome this ? Regards, Amarelia Maehsh Gujarat India

        M Offline
        M Offline
        Maverick
        wrote on last edited by
        #3

        Can I see your code? Can you trace if OnkeyDown function gets called?

        A 1 Reply Last reply
        0
        • M Maverick

          Can I see your code? Can you trace if OnkeyDown function gets called?

          A Offline
          A Offline
          Amarelia
          wrote on last edited by
          #4

          I don't mind if you want to see my code.....but where and how to send my code....can you plz give me u'r personal mail address so that I can send it over there.... And yes I have traced it but it never goes into OnKeyDown fuction. Regards Amarelia Maehsh Gujarat India

          1 Reply Last reply
          0
          • K khan

            I think you are using it in your dialog box. So all keys pressed go to the parent window. In this case it is going to the Cancel or OK button, so the application exits. You need to handle your particular key combination e.g, Ctrl + Q etc for the main dialog using accelerators. this is this.

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

            Thankx for you kind response...But sorry to say that I m not been able to understand what you are saying exactly ....Can you please say it in more details plz... Regards Amarelia Maehsh Gujarat India

            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