I have simple TCP/IP Server Windows and Client Android. How I can send received text to another appilication for example notepad or excel cell, any window application with input field. Data Received in background
private void Events_DataRecieved(object sender, SimpleTcp.DataReceivedEventArgs e)
{
var ipandPort = e.IpPort;
var data = Encoding.UTF8.GetString(e.Data);
Console.WriteLine(data);
Send(data);
}
I try this
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
public void Send(String data)
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("notepad"); //search for process notepad
if (p.Length > 0) //check if window was found
{
SetForegroundWindow(p[0].MainWindowHandle); //bring notepad to foreground
}
SendKeys.SendWait(data); //send key to notepad
}
How I can send text to any application runnuble on PC after DataRecieved. Like https://barcodetopc.com/ here Thx for help.