Link to home
Start Free TrialLog in
Avatar of tdietz
tdietz

asked on

Accelerator keys in CDialog

How can I add accelerator keys to a CDialog window?

I want to be able to act upon a certain alt-key sequence (not associated with a control such as a button).

I have created a new accelerator table with my values, but no WM_COMMAND is sent when I enter the sequence in the window (just a bell).
ASKER CERTIFIED SOLUTION
Avatar of rhgaracci
rhgaracci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tdietz
tdietz

ASKER

Originally you answer seemed to work.  However, it does not, or at least the steps I followed do not.

I have a CDialog window created.  I want to do something when the user press ALT-UP or ALT-DOWN.  I added the accelerators in the Accelerator Table, then hit CTRL-W for Class Wizard.  Everything is fine.  Two new commands are added to the window I want (which is actually a CWnd as a child of a CDialog).

I added a handler for both the functions.  When I press ALT-Up or ALT-DOWN I still get a bell.

I have tried adding new "accelerator tables" through class wizard for both the CWnd and the main CDialog.  I have even tried using a simple ALT-A sequence instead of ALT-DOWN, with no luck.