Insert text into the textbox of another application

后端 未结 4 2087
野趣味
野趣味 2020-11-30 07:54

How do I, using C# or C++, insert text into the textbox of another application? I did this a long time ago and seemed to remember something about using the applications HWND

4条回答
  •  失恋的感觉
    2020-11-30 08:49

    Instead of targeting a specific app you could just send keystrokes to the text field.

      private void button1_Click(object sender, EventArgs e)
        {
           System.Threading.Thread.Sleep(5000);
           SendKeys.Send(send_text);
    
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            send_text = textBox1.Text;            
        }
    

提交回复
热议问题