msword字问题的CallWindowProc()! [英] CallWindowProc() for ms-word problem!

查看:106
本文介绍了msword字问题的CallWindowProc()!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我已逐步解释了我的问题:

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.

推荐答案

Office应用程序进行交互的官方方法是automation,例如,请参见此处).
:)
The official way to interact with a Office application is automation, see for instance Office Automation Using Visual C++. Any other method may fail (see, for instance, here ).
:)


感谢您的回复,但

当我从应用程序使用PostMessage()发送字符时,它就起作用了.

看到这个,

PostMessage(g_hWndFocused,WM_CHAR,wp,lp);


其中:
g_hForeWnd:是winword聚焦窗口的句柄.
wp:是字符代码.
lp:重复码,即1.

如果我们说需要自动化,那么上面的代码行将不起作用.
Thanks for replying but

when i send character using PostMessage() from my application then it works.

See this,

PostMessage(g_hWndFocused, WM_CHAR, wp, lp);


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.


感谢您的回复,但

当我从应用程序使用PostMessage()发送字符时,它就起作用了.

看到这个,
Thanks for replying but

when i send character using PostMessage() from my application then it works.

See this,
<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()!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆