protected override void OnStart(string[] args) { startTheProcess(); } protected override void OnStop() { stopTheProcess(); } public void startTheProcess() { string path = "testExePath.exe"; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = false; startInfo.UseShellExecute = false; startInfo.FileName = path; try { using (Process exeProcess = Process.Start(startInfo)) { exeProcess.WaitForExit(); } } catch { // Log error. } } public void stopTheProcess() { foreach (var node in Process.GetProcessesByName("Dentrix.WebConnector.Api")) { node.Kill(); } }
WaitForExit
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)