chessweb
chessweb

Reputation: 4645

MFC-SDI application with Visual Studio 2010: New keyboard shortcut not working

I want to add a keyboard shortcut to an MFC SDI application in Visual Studio 2010. Here is what I do:

  1. Add the desired key as virtual key to the Accelerator Ressource (e.g. VK_SPACE with ID ID_NEWGAME)
  2. Connect an event handler for COMMAND to ID_NEWGAME in class CMyGameView
  3. Test by trying to stop inside the event handler using the debugger

Result: The program does not react when I hit the space key.

In Visual Studio 6.0, however, the same procedure works as expected.

What am I missing?

Upvotes: 1

Views: 1143

Answers (1)

Redeye
Redeye

Reputation: 1602

I have a hunch you're experiencing a problem I've also come across - when you create an SDI application using the latest version of MFC, by default the application loads the accelerator table from the registry at runtime therefore overwriting anything that you've specified in the resource table. I posted a solution in a previous thread here which I think is the same as what you're seeing. Hope that helps.

Upvotes: 3

Related Questions