2017-04-06 4 views
0

テキストボックス1からテキストを取り出し、他のプログラムテキストボックスに配置する必要があります。 どうすればいいですか?他のプログラムテキストボックスのテキストボックスからテキストを入力

これまでのところ私はSendKeyを見ましたが、指定されたテキストを送信していて、テキストが変更され、別のアプリケーションのテキストボックスを指定するためにテキストを送信しませんでした 私はこれを見つけましたが、

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

答えて

関連する問題