Thoross
Thoross

Reputation: 157

C++ MFC Message handling

So I'm making an MFC application that handles a couple of different messages and will display different output based on which message was handled. So right now I have one that handles the WM_KEYDOWN message and displays that message's output. Now I also have one that handles WM_RBUTTONDOWN and what I want it to do is to start up the game of Brick Breaker that I am making. The issue that I'm having is that once I enter the WM_RBUTTONDOWN I want to disable certain keys so that I can control the paddle without calling the WM_KEYDOWN.

TL:DR How do you disable certain keys from the WM_KEYDOWNin MFC.

Upvotes: 0

Views: 1092

Answers (4)

Serge Wautier
Serge Wautier

Reputation: 21878

You don't need to disable keys. It is simply up to your code to decide to process or not a key according to the state of the application.

Upvotes: 0

Mark Ransom
Mark Ransom

Reputation: 308111

You can override PreTranslateMessage to see and bypass a message before MFC does its message map translation.

Upvotes: 3

DanDan
DanDan

Reputation: 10562

You will want to forward the keys you are interested in to the code that drives your object.

Upvotes: 0

Some programmer dude
Some programmer dude

Reputation: 409166

You shouldn't have to disable keys in your application. When another program has the focus, all input should go to that program.

Upvotes: 0

Related Questions