vb.net 如何根据进程名字来取得进程的pid?
1个回答
展开全部
''' <summary>
''' 返回某进程PID
''' </summary>
''' <param name="ProcessName">进程名(不带后缀)</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function ProcessPidOnly(ByVal ProcessName As String) As String
Dim myProcess As Process() = Process.GetProcessesByName(ProcessName)
Dim pid As String = ""
If myProcess.Length - 1 = 0 Then
pid = myProcess(0).Id
Else
For i As Short = 0 To myProcess.Length - 1
pid = pid & myProcess(i).Id & ";"
Next
End If
Return pid
End Function
''' 返回某进程PID
''' </summary>
''' <param name="ProcessName">进程名(不带后缀)</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function ProcessPidOnly(ByVal ProcessName As String) As String
Dim myProcess As Process() = Process.GetProcessesByName(ProcessName)
Dim pid As String = ""
If myProcess.Length - 1 = 0 Then
pid = myProcess(0).Id
Else
For i As Short = 0 To myProcess.Length - 1
pid = pid & myProcess(i).Id & ";"
Next
End If
Return pid
End Function
大雅新科技有限公司
2024-11-19 广告
2024-11-19 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,...
点击进入详情页
本回答由大雅新科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询