Click here to Skip to main content
15,917,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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. 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.
Posted
Updated 14-Jan-10 18:06pm
v2

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 ).
:)
 
Share this answer
 
v2
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.
 
Share this answer
 
v2
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 />


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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900