2017-04-06 128 views
0

我需要從textbox1中獲取文本並將其放到其他程序文本框中。 我該怎麼做?在其他程序文本框中輸入文本框中的文本

到目前爲止,我看到SendKey但正在發送指定的文字和我的文字會改變,也不會發短信到指定的其他應用程序 我瑤池像這樣的文本框,但我不知道在哪裏推杆secify應用

using System; 
using System.Runtime.InteropServices; 
using System.Windows.Forms; 

namespace WindowsFormsApplication1 
{ 
    public partial class Form1 : Form 
    { 
     const uint WM_SETTEXT = 0x000C; 

     [DllImport("user32.dll", CharSet = CharSet.Auto)] 
     static extern IntPtr SendMessage(IntPtr hWnd, unit Msg, 
      IntPtr wParam, string lParam); 

     public Form1() 
     { 
      InitializeComponent(); 
     } 

     private void textBox1_TextChanged(object sender, EventArgs e) 
     { 
      MessageBox.Show(textBox1.Text); 
     } 

     private void button1_Click(object sender, EventArgs e) 
     { 
      SendMessage(textBox1.Handle, WM_SETTEXT, IntPtr.Zero, 
       textBox1.Text + ", " + textBox1.Text); 
     } 
    } 
} 

回答

相關問題