问题描述
For Each proc As Process In Process.GetProcesses
If proc.ProcessName = "MyDosApp" Then
proc.CloseMainWindow()
proc.Close()
End If
Next
我已经阅读了有关CloseMainWindow()和WaitForExit()的MS文档,并且我相信自己在正确的地方,但是只是不确定在过程关闭并消失后如何使用它们清除教科书内容。
任何帮助表示赞赏。
伊恩
解决方法
按照Martheen的建议,只需在proc.WaitForExit()之后调用TextBox1.Clear()即可实现我想要的功能。
For Each proc As Process In Process.GetProcesses
If proc.ProcessName = "MyDosApp" Then
proc.CloseMainWindow()
proc.WaitForExit()
Textbox1.clear()
proc.Close()
End If
Next