使用system.diagnostics.process时出错 [英] Error while using system.diagnostics.process
本文介绍了使用system.diagnostics.process时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim theprocess As System.Diagnostics.Process
For Each theprocess.Threads.Item In Process.GetProcessesByName(Form1.TextBox1.Text)
ListView1.Items.Add(theprocess.Threads)
Next
我必须在列表视图中添加流程线程
还有其他方法吗?
抱歉我的英文...
I have to add a process threads to a listview
Any other way to do that?
Sorry for my english...
推荐答案
你不能直接将线程添加到列表视图 - ProcessThread不会覆盖ToString,所以你会得到的只是每个人都有
You can''t add threads directly to a listview - ProcessThread does n''t override ToString, so all you would get is
System.Diagnostics.ProcessThread
。
你做不到无论如何!
for each one.
And you can''t do it that way anyway!
For Each p As Process In Process.GetProcessesByName(Form1.TextBox1.Text)
Console.WriteLine(p)
For Each pt As ProcessThread In p.Threads
Console.WriteLine(" {0}", pt)
Next
Next
至少会给你一些起作用的代码!
Will at least give you some code that works as a starter!
这篇关于使用system.diagnostics.process时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文