A possible duplicate: Directly sending keystrokes to another process via hooking
I would like to apologize if the tone in my question is a bit bad. I am stuck right know. Okay, I am working to make a program that would transfer data from a WPF application to both a VB 6 application and a web page. Depending on the configuration it will call a procedure to post data. I already finished the VB 6 side but having a big issue with the web page since:
- The procedure MUST work on all known browsers.
- I am not allowed to send the data as a web request.
- I don't have control for the web site to be used.
- I also am not allowed to use any third party software
I already tried the following:
- Sendmessage with keyup and keydown for tab and character keys
- Sendmessage with postmessage for the string to be sent
- Postmessage version of the above
- MSHTML for sending data as HTMLdocument
- SendKeys (though not yet explored it heavily)
Here is the code for the sendmessage (closest to all of my tries)
IntPtr window = User32_Methods.FindWindow(null, "Test Site");
if(window!=IntPtr.Zero)
{
MessageBox.Show("asdasd");
User32_Methods.SendMessage(window, Send_Message_Constants.WM_LBUTTONDOWN, IntPtr.Zero, IntPtr.Zero);
User32_Methods.SendMessage(window, Send_Message_Constants.WM_LBUTTONUP, IntPtr.Zero, IntPtr.Zero);
for (int count = 0; count < 15;count++)
{
User32_Methods.PostMessage(window, Send_Message_Constants.WM_KEYDOWN, (IntPtr) Send_Message_Constants.VK_TAB, IntPtr.Zero);
User32_Methods.PostMessage(window, Send_Message_Constants.WM_KEYUP, (IntPtr)Send_Message_Constants.VK_TAB, IntPtr.Zero);
foreach(char a in "adasdasdasd")
{
User32_Methods.PostMessage(window, Send_Message_Constants.WM_KEYDOWN, (IntPtr)Send_Message_Constants.VK_A, IntPtr.Zero);
User32_Methods.PostMessage(window, Send_Message_Constants.WM_KEYUP, (IntPtr)Send_Message_Constants.VK_A, IntPtr.Zero);
}
}
}
I would like to ask you guys at stack since you solved most of the questions that I am having an issue here.