Windows Procedure; "Application should return 0 if it processes (WM_KEYDOWN)"

Started by raleeper, August 30, 2011, 04:41:26 AM

Previous topic - Next topic

raleeper

1.  Why?.  If  I pass the message to the default windows procedure what will the os do with it (I don't need details)?

2.  If the app looks at the key and decides to ignore it, does that count as having processed it?

Thanks, ral

dedndave

1) well, it says "should"   :P
you chose a very benign case, as not much happens either way
but, it is best to follow the recommended procedure
subtle little things can happen if you do not
for some WM messages, the results are not subtle at all   :bg

2) if your window has keyboard focus, the key press "belongs to you"
that means that if you have examined it and decided to ignore it, it has been fully processed

this kind of stuff becomes more obvious if you have a child window
for some messages, the OS sends unhandled messages up or down the chain of windows until it is processed
WM_PAINT is a good example

ToutEnMasm


Quote
1.  Why?.  If  I pass the message to the default windows procedure what will the os do with it (I don't need details)?
This return value is used by the OS to do something or not .It is this answer he wait.
Quote
2.  If the app looks at the key and decides to ignore it, does that count as having processed it?
Most of the keyboard keys  create just  messages send to all windows.No more thing is made.
EXCEPT for some keyboard shorcut like CTRL-C
EXCEPT for some keyboard shorcut used by controls like Richedit.
You can filter those keys (and suppress her action) if you don't return them back
You can also add furher actions and return them


Geryon

Quote from: raleeper on August 30, 2011, 04:41:26 AM
1.  Why?.  If  I pass the message to the default windows procedure what will the os do with it (I don't need details)
You don't want to know the details, however you are asking the details.
Simple answer: "An application should return zero if it processes this message. "
"Some people have got a mental horizon of radius zero and call it their point of view." --D.Hilbert

Tedd

Rephrase it to "Application should return 0 if it does not want any further action to be taken in response to this message"

Makes sense now?
No snowflake in an avalanche feels responsible.

raleeper

Quote from: Tedd on August 30, 2011, 11:39:41 AM
Rephrase it to "Application should return 0 if it does not want any further action to be taken in response to this message"

Makes sense now?


Yes.  That clarifies.


Thanks, Robert