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"

        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);

There are several way to share data beween applications. I would suggest communication via a port (UDPCLient for instance, easy to implement).

Shared memory is a solution when you have important volume of data to exchange (bitmap) but I fear you have to write a dll in non managed code for this.

You can try the Clipboard class that allow to write and read the containt of the clipboard. It is very simple to implement but I am a little suspicious with using the clipboard because it is shared by all applications.

Using shared memory is very easy in C#, no need for unmanaged code. Just do a search on memory mapped files.

But I believe the original poster is trying to create software to automate something he doesn't have the source for, such as a game.

This article has been dead for over six months. Start a new discussion instead.