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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

KEYBOARD hook and WM_CHAR message

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
One location in the MSDN library says that the hook WH_KEYBOARD will catch
the WM_CHAR message, another says that it will catch only WM_KEYUP and WM_KEYDOWN.


If it is possible to catch the WM_CHAR message, how do I tell it is that
message? And how do I post that message to another window (wParam is the
virtual keystroke - I want the ASCII character, available with WM_CHAR)?

Thanks

 
Yes, it is possible. Message WM_CHAR cames usualy after WM_KEYDOWN of after both WM_KEYDOWN/WM_KEYUP, but never before. John Fill
1c.bmp


ivfmd@mail.md
 
How do I determine the WM_CHAR event has been triggered? No information is about the event is give in the WH_KEYBOARD callback function.
 
put in your wndproc in main handler

switch(msg)
{
.....
case WM_CHAR:
MessageBox(0,"No I know what happend a WM_CHAR","received",0);
return 0; John Fill
1c.bmp


ivfmd@mail.md
 
I meant how do I tell the WM_CHAR message has been triggered in the KeyboardProc function (the callback function to a WH_KEYBOARD hook).
 
In this case, can you say what your trouble is? John Fill
1c.bmp


ivfmd@mail.md
 
After installing a system wide WH_KEYBOARD hook (using SetWindowsHookEx)I declare it's callback function to be KeyboardProc.

This function is called just before a keyboard message is sent to any window. I want to be able to determine if the message calling this function is a WM_CHAR message (as opposed to a WM_KEYDOWN or WM_KEYUP message).

Thanks
 
are you sure this function is called just before a keyboard message? Nothing can be happend before message. This function is called before any other windows/threads receive this message. The default hook(system hook) is called after you executing your hook what you've set. What you need is do CallNextHookEx or not in deppending on do you want other applications to receive keyboard message or not. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top