CompuServe Thread

#KEYDOWN/UP but no CHAR

4 messages in this thread
#30297From: Sumeet ShrivastavaJul 8, 1994 1:07 PM
Paul, You said that you were spying on your formview window and you were getting WM_KEYDOWN/UP messages but not WM_CHAR. Typically, you would not get those messages also in a formview. This is because if a formview has any controls, the focus would be with one of those controls and the control would receive the messages. So, if you are receiving WM_KEY messages, probably you don't have any controls. So, if the formview does not have any controls, why use a formview? Why not a simple view itself? Anyway, if you are not getting WM_CHAR, it could be because ::TranslateMessage is not being called for a formview. ::TranslateMessage is the function that converts the WM_KEYDOWN/UP to a WM_CHAR. The workaround would be to process the WM_KEYDOWN itself and check the virtual key code to see if it is a character. Paul, hope this helps. Thanks. Sumeet Shrivastava Microsoft Developer Support
#30307From: Amtel SystemsJul 8, 1994 3:15 PM
Sumeet, >if a formview has any controls, the focus would be with one of those controls and the control would receive the messages Actually, I had the controls pass the keydown/keyup and char up to its parent. I will look to see if there is something with the TranslateMessage() As another clue I noticed that before the keydown occurred there was a WM_GETDLGCODE message passed. Thanks for your help, Paul
#30566From: Sumeet ShrivastavaJul 11, 1994 6:48 PM
Hi Paul, >Actually, I had the controls pass the keydown/keyup and char up >to its parent. This explains why you are getting WM_KEYUP and WM_KEYDOWN but no WM_CHAR messages. Not all controls get all the messages. e.g. Buttons get key up/down messages but no WM_CHARs. What messages a control gets depends on how the control procedure responds to the WM_GETDLGCODE message. A very good explanation of what WM_GETDLGCODE is, and what messages a control might receive, is given in article Q83302 in the Microsoft Knowledge Base. Paul, I think going through that article would make things more clear. Thanks. Sumeet Shrivastava Microsoft Developer Support
#30698From: Amtel SystemsJul 12, 1994 1:19 PM
Thank-you, Paul