查找程式是否已經運行的三種方法:
1.
If Ubound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProsseName))>0 then
messagebox.show("程式正在運行!")
end if
2.
Dim ps As new Process
For Each ps In Diagnostics.Process.GetProcesses
If pro.ProcessName = "行程名稱" Then
messagebox.show("程式正在運行!")
End If
Next
3.
'寫一個功能。
Function FindProcess(ProcessName) As Boolean
Dim ps
'列舉行程
For Each ps In GetObject("winmgmts:\\.\root\cimv2:win32_process").instances_ '回圈行程
If UCase(ps.Name) = UCase(ProcessName) Then
FindProcess = True
Exit Function
End If
Next
End Function
,=以下呼叫程序
If FindProcess("xxxx.exe") Then '在此修改為你要找的程式名
MsgBox.show ("該程式正在運行!")
Else
MsgBox .show("該程式不正在運行!")
End If
uj5u.com熱心網友回復:
發錯版了,.Net有自己的專區。uj5u.com熱心網友回復:
在哪里?哈哈,我隨便發的轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/8903.html
標籤:資源
上一篇:(急)vb 呼叫c++ dll 時 wchar_t 應該怎么對應?
下一篇:讀取外部程式運行視窗的內容
