VB取系统进程列表
installmentcontrols:添加控件1)Placeabuttonintheform添加按钮2)PlaceaTextBoxintheFormandnameitastxtProcesses添加TextBox命名为txtProcesses3)SettheMulti-linepropertyoftheTextBox(txtProcesses)toTrue设置TextBox的Multi-line属性为true4)ImporttheSystemnamespace进口系统namespace5)WritethefollowingcodeintheCommandButtonclickEvent代...全部
installmentcontrols:添加控件1)Placeabuttonintheform添加按钮2)PlaceaTextBoxintheFormandnameitastxtProcesses添加TextBox命名为txtProcesses3)SettheMulti-linepropertyoftheTextBox(txtProcesses)toTrue设置TextBox的Multi-line属性为true4)ImporttheSystemnamespace进口系统namespace5)WritethefollowingcodeintheCommandButtonclickEvent代码如下:**************************************** ()AsSystem。
Diagnostics。ProcessDimsProcessAsSystem。Diagnostics。ProcessDimsAsStringOnErrorGotoErrorHandlersProcesses=System。
Diagnostics。Process。GetProcesses()s=""s=vbCrLf&"ProcssInfo"&vbCrLfForEachsProcessInsProcessess=s&sProcess。
Id&Space(5)&sProcess。ProcessName()&vbCrLfNexttxtProcesses。Text=sErr "UnexpectedErroroccurred"System。
Diagnostics。ProcessisNameSpaceprovidesthemethodGetProcesses()togetthelistofprocessrunninginyoursystem。
ThisfunctionreturnsObjectarrayoftypeProcess。TheIDandProcessNamepropertiesoftheProcessobjectcanbeusedtoretrivetheProcessID(PID)andtheNameprocess。
TheoverloadedfunctionGetProcesseswith>parametercanbeinvokedtogetlistofprocessesrunninginaremotesystem。
收起