updated
I have a problem related to Process.Start(); My program runs files as processes, for example:
Process processMonitor = new Process(); processMonitor.StartInfo.FileName = filePath; // Example: @"C:\test.txt" processMonitor.StartInfo.CreateNoWindow = true; processMonitor.Exited += new EventHandler(Process_Exited); processMonitor.EnableRaisingEvents = true; processMonitor.Start(); // Handle Exited event and display process information. private void Process_Exited(object sender, EventArgs e) { // This code is called on every exit, except images: (Windows Photo Viewer, *jpg, *png, *bmp etc.) }
This successfully starts the notepad.exe process with the correct file. Capturing the Exit event also works so that basically I have everything to control the close event for the process.
Now for the problem ...
Doing the same thing, but now for the image:
processMonitor.StartInfo.FileName = filePath; // Example: @"C:\test.jpg"
This was unsuccessful .. The process starts fine, but I cannot determine if the process is closed. A little research shows me that the process is called
DLLHOST.EXE (COM Surrogate)
It starts and I cannot detect the Exited event for this process.
Can someone help me or at least point me in the right direction?
source share