Hi,
I wonder how it would be possible to set a "string" in another application. I know the "MainWindowTitle" as my code goes below but I dont know how to set the text in one textBox that exists there. The thing I have to start with is the below but dont know how to continue from here.
I dont know the names of the textBox on "someSoftware"
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, int
wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam);
private const int WM_SETTEXT = 0x0C;
private void button8_Click(object sender, EventArgs e)
{
foreach (Process p in Process.GetProcesses())
{
String applicationName = p.MainWindowTitle.ToString().ToLower();
if (applicationName.IndexOf("someSoftware") != -1)
{
string txt = "Hello World";
IntPtr hWnd = p.Handle;
SendMessage(hWnd, WM_SETTEXT, 0, txt);
break;
}
}
}