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