比如说触发那个应用程序里的某个事件,或修改某个控件的属性?

解决方案 »

  1.   

    可以使用sendkeys.sendwait()方法
    例如:
    Dim myProcess As Process = New Process()
            myProcess.StartInfo.FileName = "notepad"
            myProcess.StartInfo.WindowStyle = _
            ProcessWindowStyle.Normal
            myProcess.EnableRaisingEvents = True
            AddHandler myProcess.Exited, AddressOf Me.SendKeysTestExited
            myProcess.Start()        myProcess.WaitForInputIdle(1000)
            If myProcess.Responding Then
                System.Windows.Forms.SendKeys.SendWait( _
                "This text was entered using the " & _
                "System.Windows.Forms.SendKeys method.")
            Else
                myProcess.Kill()
            End If
        End Sub
    效果是在写字板里输入字符串
    This text was entered using the System.Windows.Forms.SendKeys method
      

  2.   

    用 .net 中的委托和事件机制可以显示你的功能了比如说:你为窗体程序中的一个 button 注册一个click事件,并在事件事件处理程序中写上逻辑处理代码;一旦,button 被点击,就会执行事件处理程序中的代码
      

  3.   

    SendKeys只能给活动的程序发送消息啊,要是不活动的呢?
    或者说,怎样给最小化在任务栏的应用程序发送消息呢?