1
如果我的主進程或父進程在任務管理器中被「終止進程樹」殺死,我該如何保留子進程?如果父進程中斷,請保留子進程
Private Sub Sexecute(ByVal exe As String)
Dim getPath As String = Application.StartupPath
Dim startInfo As New ProcessStartInfo
startInfo.FileName = exe
Process.Start(startInfo)
End Sub
''System.Threading.Timer
Private Sub LockEpsonCallBack(ByVal state As Object)
'''Check if Tree Locker is in the process
Dim tlockerfound As Boolean
For Each list As Process In Process.GetProcessesByName("tlocker")
tlockerfound = False
If list.ProcessName = "tlocker" Then
tlockerfound = True
Exit For
End If
Next
If tlockerfound = False Then
Sexecute("tlocker.exe")
End If
End Sub
有沒有可能的方式做到這一點?
我沒有使用「UseShellExecute」,但我懷疑同樣的事情發生,因爲在Delphi中使用shellexecute它也關閉了父進程被終止時的子進程,感謝評論。 – XXXXXXXXXXXXXX