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

有没有办法做到这一点?

4

1 回答 1

1

我知道您可以将线程设置为执行相同操作的前台(而不是后台)。我不确定是否有进程的等价物,但您可以看到使用 UseShellExecute 会发生什么或将其包装在前台线程中。

于 2013-06-12T14:28:30.310 回答