[DllImport("user32.dll", EntryPoint = "FindWindowEx")]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
private void textBox1_TextChanged(object sender, EventArgs e)
{
Process[] notepadprocess = Process.GetProcessesByName("notepad");
IntPtr child = FindWindowEx(notepadprocess[0].MainWindowHandle, new IntPtr(0), "EDIT", null);
SendMessage(child, 0X000C, notepadprocess[0].Id, textBox1.Text);
}
above codes was good for my textbox1.Text value on my form to a notepad that already running
but my Exactly question is :
how to use SendMessage in other process INSTEAD OF NOTEPAD
[DllImport("user32.dll", EntryPoint = "FindWindowEx")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll")] public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
private void textBox1_TextChanged(object sender, EventArgs e) { Process[] notepadprocess = Process.GetProcessesByName("notepad"); IntPtr child = FindWindowEx(notepadprocess[0].MainWindowHandle, new IntPtr(0), "EDIT", null); SendMessage(child, 0X000C, notepadprocess[0].Id, textBox1.Text); } above codes was good for my textbox1.Text value on my form to a notepad that already running but my Exactly question is : how to use SendMessage in other process INSTEAD OF NOTEPAD
many thanks for cooperations