Vb2008 如何获取进程PID
Public Function FindPID(ByVal strGameNameAs String) As BooleanDim pe32 As PROCESSENTRY32
Dim hSnapshot As Integer
Dim bProcFound As Boolean
Dim bFoundGame As Boolean
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0)
pe32.dwSize = Len(pe32)
bProcFound = Process32First(hSnapshot,pe32)
Do While bProcFound
If Right(LCase(Left(pe32.szExeFile,
InStr(1, pe32.szExeFile, Chr(0)) - 1)), Len(strGameName)) = LCase(strGameName)
Then
dwProcId = pe32.th32ProcessID
bFoundGame = True
End If
bProcFound = Process32Next(hSnapshot,pe32)
Loop
CloseHandle(hSnapshot)
dwHandle = OpenProcess(&H1F0FFF,False, dwProcId)
FindGame = bFoundGame
End Function
之前用这个获取程序的PID,可是变成了2008就好像不行
有想过用Process.GetProcessesByName不过不太会用,因为出来的
好像不是我所想要的值(dwProcId),如果有人可以用这个得出PID的数值出来也可以 --------------------编程问答--------------------
Dim prcA As Process--------------------编程问答--------------------
For Each prcA In Process.GetProcessesByName(txtProcName.Text)
MessageBox.Show(prcA.Id)
Next
Process.GetCurrentProcess.Id.ToString()
补充:.NET技术 , VB.NET