本帖最后由 jianmtao 于 2009-07-30 15:10:16 编辑

解决方案 »

  1.   

    1.有没有尝试过一次发送整个字符串而非将其拆分后再发?
    2.如果能获得该窗口上对应的控件句柄,也可以使用API函数SetWindowText来设置文本。
      

  2.   

           private void sendMessage(string msg, string info)
            {
                try
                {
                    SetForegroundWindow(xHandle);                //for (int i = 0; i < msg.Length; i++)
                    //{
                        SendKeys.Send(msg);
                    //}                //SendKeys.Send("{ENTER}");
                    SetForegroundWindow(xHandle);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString()); //抛出异常信息 
                }        }
            //Start按钮
            private IntPtr xHandle;
            private void buttonStart_Click(object sender, EventArgs e)
            {
                xHandle = FindWindow(null, pubV.appPath);
                sendMessage("12", "oo");
    }
    也不行,就只能1位字符串才可以,其他的点Start按钮,另一个程序界面只有光标在闪,没反应的