Sending Return Key input to “WordPerfect 6.x - 7.0 Conversion" Window from C# code

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<br/>
Hi,
We are performing office automation(opening .doc,.wpd files and saving them as .html) in console application using Microsoft.Office.Interop.Word in C#.
When WPD file with graphic content is processed using the application,âWordPerfect 6.x - 7.0 Conversion" window is getting displayed and that window expects "Return" Key as input.Tried to send Return Key input automatically from application using the
following methods:
Sendmessage
WinAPI.SendMessage(hWnd,WinAPI.WM_SYSCOMMAND, VK_RETURN, 0); //sending return key
WinAPI.SendMessage(hWnd,WinAPI.WM_SYSCOMMAND,SC_KEYMENU,y) //sending Y key<br/>
WinAPI.SendMessage(hWnd,WinAPI.WM_SYSCOMMAND, VK_SPACE, 0) //sending space
//sending return key with WM_SYSKEYDOWN and WS_SYSKEYUP
SendMessage(hWnd, WM_SYSKEYDOWN, VK_RETURN , 0);<br/>
SendMessage(hWnd, WM_SYSKEYUP, VK_RETURN , 0);
WinAPI.SendMessage(hWnd,WinAPI.WM_SYSCOMMAND,WinAPI.SC_CLOSE,0);//to close the window

PostMessage
PostMessage(hWnd, WM_KEYDOWN, VK_RETURN, 0);
PostMessage(hWnd, WM_KEYUP, VK_RETURN, 0);
SendKeys
SetForegroundWindow(hWnd);
<br/>
SendKeys.SendWait("Y");
Keybd_event <br/>
keybd_event(134, 0x45, KEYEVENTF_KEYDOWN | KEYEVENTF_EXTENDEDKEY, 0);<br/>
keybd_event(13, 0x45, KEYEVENTF_KEYDOWN | KEYEVENTF_EXTENDEDKEY, 0);<br/>
keybd_event(13, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);<br/>
keybd_event(134, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0)
The above solutions are not working.However,we have similar implementation in the application to close "Show Repairs" and "Microsoft Office Word" (WinAPI.SendMessage(hWnd,WinAPI.WM_SYSCOMMAND,WinAPI.SC_CLOSE,0)) which works perfectly fine.
Can anyone help me in sending Return Key input to "WordPerfect 6.x -7.0 Conversion" window from C# code?

Thanks in advance,<br/>
Sivakumar

View the full article
 
Back
Top