954,487 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Keyboard Event Handles in VC++

Hi everyone,

I've been googling this for a long time, and most of the hits are about keyboard shortcuts in the actual IDE... it's so annoying.. :(

I'm working on a pretty big VS project (about 20 source files).. I have to add some keyboard functionality to it... simple stuff like Ctrl+N for "new" and Left for "last [whatever]" and Right for "next [whatever]"..

I've looked into GetAsynchKeyState(), but I think that applies to any keystrokes (even outside the program), and moreover I don't know what number key maps to what...
I'm amazed there's no easy way of doing this.. I spent a while looking through the toolbox and found nothing.. :(

Thank you so much!

phalaris_trip
Junior Poster in Training
91 posts since Apr 2007
Reputation Points: 15
Solved Threads: 5
 

is this what you are looking for ?

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Do you have a GUI and a Menu? If so, then you should search on the subject of keyboard accelerators
This may also help.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

since you are using VC++ i am assuming you arein the .NET framework?

do you happen to be working with windows forms?

System::Windows::Forms

if so then you can capture keyboard input very easy on any form.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

Thank you all for your replies,

I got it working eventually using PreTranslateMessage.

The problem was basically that I had a richedit box in my dialog and as soon as the dialog opened, the richedit box took focus and prevented me from being able the standard ways of assigning shortcuts..

phalaris_trip
Junior Poster in Training
91 posts since Apr 2007
Reputation Points: 15
Solved Threads: 5
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You