DSAPI CMD命令行进程代理
2021-06-04 08:03
标签:退出 cas 启动 star .text 进程 cti invoke nta DSAPI.文件.CMD命令行进程代理,是用来和CMD.exe或指定exe进行输出重定向的简化使用工具,可隐藏或显式地启动一个cmd.exe,并将输出流、输入流和错误流重定向至代理,通过事件触发方式与之交互。 相关代码如下: DSAPI CMD命令行进程代理 标签:退出 cas 启动 star .text 进程 cti invoke nta 原文地址:https://www.cnblogs.com/dylike/p/10862012.html Private WithEvents CMD命令行 As New DSAPI.文件.CMD命令行进程代理
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
CMD命令行.启动CMD命令行进程()
End Sub
Private Sub CMD命令行进程_有输出内容(Sender As CMD命令行进程代理, 输出内容 As String) Handles CMD命令行.有输出内容, CMD命令行.有输出报错内容
Me.BeginInvoke(New SetText(AddressOf SetTextA), 输出内容)
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
CMD命令行.退出进程()
End Sub
Private Delegate Sub SetText(S As String)
Private Sub SetTextA(S As String)
TextBox2.Text &= S
TextBox2.SelectionStart = TextBox2.TextLength
TextBox2.ScrollToCaret()
End Sub
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
Select Case e.KeyValue
Case Keys.Enter, Keys.Return
CMD命令行.输入(TextBox1.Text)
TextBox1.Clear()
Exit Sub
End Select
End Sub