如果主要或父进程被“结束进程树”在任务管理器中杀死或杀死,我如何保留我的子进程?
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
有可能这样做吗?
答案 0 :(得分:1)
我知道你可以将一个线程设置为前景(而不是背景),它做同样的事情。我不确定它是否有相同的进程但你可以看到使用UseShellExecute会发生什么或将它包装在前台线程中。