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. Arrow keys in CDialog

Arrow keys in CDialog

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

    Does any have the problem processing the VK_LEFT\VK_RIGHT key in CDialog? I was trying to do an animation in dialog which a small bitmap will move around the dialog box when an arrow key is pressed (super mario style :) ), however I'm having problem processing the arrow keys in the OnKeyDown(). I tried to trace the messages, and it seems the window is getting the the WM_KEYDOWN message when an arrow key is pressed, but it just ignores it!! (No problem with keys like VK_DELETE, VK_END.. etc., tho). Is there anything special I should know about processing the arrow keys in a dialog box? Thanks!

    A 1 Reply Last reply
    0
    • A Allen Sun

      Does any have the problem processing the VK_LEFT\VK_RIGHT key in CDialog? I was trying to do an animation in dialog which a small bitmap will move around the dialog box when an arrow key is pressed (super mario style :) ), however I'm having problem processing the arrow keys in the OnKeyDown(). I tried to trace the messages, and it seems the window is getting the the WM_KEYDOWN message when an arrow key is pressed, but it just ignores it!! (No problem with keys like VK_DELETE, VK_END.. etc., tho). Is there anything special I should know about processing the arrow keys in a dialog box? Thanks!

      A Offline
      A Offline
      Allen Sun
      wrote on last edited by
      #2

      OK, I just found out the answer. The problem was in the WM_GETDLGCODE. Apparently window dosn't trust anybody but him self to handle the arrow key and tab keys. What I did was just simply return DLGC_WANTMESSAGE in the the OnGetDlgCode() function. (Thanks, MSDN, for burying this tiny IMPORTANT notice in MILLIONS of articles)

      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