Want to send the text from my current vb application to the Active Window and that text should be displayed in the text area of the active window can anyone help me?
A:
You need to send WM_SETTEXT message to the text control. Like this:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern void SendMessage(IntPtr hWnd, uint Msg, int wParam, string lParam);
private const int WM_SETTEXT = 0x0C;
private void button1_Click(object sender, EventArgs e)
{
string txt = "Hello World";
SendMessage(richTextBox1.Handle, WM_SETTEXT, 0, txt);
}
Jacob Seleznev
2010-03-23 20:58:54