Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MFC Keyboard handler help needed please 1

Status
Not open for further replies.

Wiggis

Programmer
Jun 9, 2003
10
GB
I have a dlg box created in MFC and i need to handle a certain key combination:

CTRL+E+G+S

i only know how to handle individual key presses

any help would be appreciated.

Cheers,
Wiggis
 
First do this:
#define DOWN(key) (GetAsyncKeyState(key) & 0x8000)

Then just check all of the keys

if(DOWN('E') && DOWN('G') && DOWN('S') && DOWN(VK_CONTROL))
{
// do stuff
}

You should know that GetAsyncKeyState() doesn't work sometimes when you press multiple keys simultaneously. If it doesn't end up working well enough this way, try using DirectInput. It would take more work, but it wouldn't have this problem, and it isn't really all that difficult (DInput is the simplest part of DirectX).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top