[Solved] open new notepad.exe and write content to it [duplicate]


try this one source

 [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 button1_Click(object sender, EventArgs e)
        {
            Process [] notepads=Process.GetProcessesByName("notepad");
            if(notepads.Length==0)return;            
            if (notepads[0] != null)
            {
                IntPtr child= FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), "Edit", null);
                SendMessage(child, 0x000C, 0, textBox1.Text);
            }
        }

5

solved open new notepad.exe and write content to it [duplicate]