问题描述
你好,
我已逐步解释了我的问题:
1.首先,我将Windows程序对Winword进行了子分类,并具有适当的子分类要求(规则).
2.子类化后,我将从自己的应用程序向Winword发送WM_USER + 40个字符为"x"的消息.
3.由于我首先将其分类,因此"x"将进入我的WndProc,然后我将对"x"进行一些操作,处理后的"x"将转发到原始winwords的WndProc.请参阅关注我的WndProc
Hello,
I have explained my problem step by step:
1. Firstly I have sub-classed the winword with my windows procedure with appropriate sub-classing requirement (rules).
2. After sub-classing, from my own application i am sending WM_USER + 40 message with character ''x'' to winword.
3. As i have sub-classed first this ''x'' will come to my WndProc then i will do some operation on ''x'' and processed ''x'' will forward to original winwords ''s WndProc. See following my WndProc
LRESULT CALLBACK
NewWndProcFocused(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam
)
{
LRESULT lResult;
switch (message)
{
case WM_USER + 40:
message = WM_CHAR;
break;
}
//
// Calling original focused window procedure.
//
lResult = CallWindowProc(
g_WndProcFocusedOrignl,
hwnd,
message,
wParam,
lParam
);
return lResult;
}
4.现在,单词WndProc应该在ms-word上写"x".
5.但是我没有看到任何结果.
但是对于其他应用程序(例如Internet Explorer,记事本,写字板),只要在工作的地方即可.
谢谢与问候
Joseph.
4. Now words WndProc supposed to write ''x'' at ms-word .
5. But i am not seeing any result.
But for other application''s like Internet Explore, Notepad, Wordpad every where it is working.
Thanks and Regards
Joseph.
推荐答案
<br />
PostMessage(g_hWndFocused, WM_CHAR, wp, lp);<br />
其中:
g_hForeWnd:是winword聚焦窗口的句柄.
wp:是字符代码.
lp:重复码,即1.
如果我们说需要自动化,那么上面的代码行将不起作用.
where :
g_hForeWnd : is handle to focused window of winword.
wp: is a character code.
lp: repeate code i.e. 1.
If we are saying that automation is required then above lines of code should not be work.
这篇关于msword字问题的CallWindowProc()!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!