|
-
May 27th, 1999, 07:45 PM
#1
SendMessage from DLL to Words
Hi everyone,
I developed a program which intercept and translate keyboard characters to one or two other characters. I used WH_WH_GETMESSAGE system wide hook in a DLL, translate each character and SendMessage to the active focusing window. This process requires me to sometine send a BACK SPACE to the active window to erase previous displayed character and relpace it with a new character upon ensuing SendMessage of new character.
Well, this program (DLL) seems to work fine with notepad.exe, hotmail and other simple application but not with Microsoft Words. Why ? Helpppp !!!
Below is a portion of the code inside WM_GETMESSAGE callback routine ..
#define BACKSPACE 0x8
...
if (lpMsg->message == WM_CHAR)
{
// translate this character
WPARAM wOut = a2v(lpMsg->wParam, &cPrev, &cPrev1);
if (lpMsg->wParam != wOut) // yes translated
{
// erase previous (untranslated) displayed character with backspace
HWND hwFocus = ::GetFocus();
SendMessage(hwFocus, WM_KEYDOWN, VK_BACK, 0x000E0001);
SendMessage(hwFocus, WM_CHAR, BACKSPACE, 0);
SendMessage(hwFocus, WM_KEYUP, VK_BACK, 0xC00E0001);
}
lpMsg->wParam = wOut; // update new character
return CallNextHookEx(ghGetMessageHook, nCode, wParam, lParam);
}
thanks
-
May 27th, 1999, 09:33 PM
#2
Re: SendMessage from DLL to Words
Obviously Microsoft Word handles keystrokes differently than the other apps you mentioned. Wouldn't you have to know how Microsoft Word keyboard handling functions work before presuming that you can intercept the keystroke processing? Also, you don't intercept WM_KEYDOWN or WM_KEYUP. How do you know that Word doesn't use those messages in some way? I know that a lot of apps don't need to handle the WM_KEYxxxx messages, and just look at WM_CHAR, which is probably why you only intercepted WM_CHAR. Word is an app that doesn't seem to work that way.
Regards,
Paul McKenzie
-
May 28th, 1999, 11:14 AM
#3
Re: SendMessage from DLL to Words
Hi Paul,
Yes, I'd like to know how Words handle keyboard but don't know where to find that info. I looked all over in MSDN with no success. Do you have any leads ?
Best Regards,
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|