No process is associated with this object error

  • Thread starter Thread starter vtxr1300
  • Start date Start date
V

vtxr1300

I have the following code and when it hits the WaitForIdleInput() line,
it gives me the exception "No process is associated with this object".
I've searched the groups and read a ton of posts about this error, but
no suggestions have fixed it. What can I try? Thanks.

ProcessStartInfo si = new ProcessStartInfo(appPath + "lame", "
--abr 64 " + source + " " + destination);
si.UseShellExecute = false;
si.RedirectStandardOutput = true;
System.Diagnostics.Process oProcess = new Process();
oProcess.StartInfo = si;
oProcess.WaitForInputIdle();
if (!oProcess.HasExited)
oProcess.WaitForExit();
 
vtxr1300 said:
I have the following code and when it hits the WaitForIdleInput() line,
it gives me the exception "No process is associated with this object".
I've searched the groups and read a ton of posts about this error, but
no suggestions have fixed it. What can I try? Thanks.

ProcessStartInfo si = new ProcessStartInfo(appPath + "lame", "
--abr 64 " + source + " " + destination);
si.UseShellExecute = false;
si.RedirectStandardOutput = true;
System.Diagnostics.Process oProcess = new Process();
oProcess.StartInfo = si;
oProcess.WaitForInputIdle();
if (!oProcess.HasExited)
oProcess.WaitForExit();

Nevermind, I think I figured it out. For some reason, all the code I
saw never included the oProcess.Start portion. I put that in and then
it would start the process, but eventually cause an exception on the
WaitForInputIdle line. I commented that out and it's working now. Can
anyone shed some light on why the WaitForInputIdle caused a problem?
The exception said something about not having a GUI interface. Thanks.
 
vtxr1300 said:
I have the following code and when it hits the WaitForIdleInput() line,
it gives me the exception "No process is associated with this object".
I've searched the groups and read a ton of posts about this error, but
no suggestions have fixed it. What can I try? Thanks.

ProcessStartInfo si = new ProcessStartInfo(appPath + "lame", "
--abr 64 " + source + " " + destination);
si.UseShellExecute = false;
si.RedirectStandardOutput = true;
System.Diagnostics.Process oProcess = new Process();
oProcess.StartInfo = si;

I see you never call "oProcess.Start()". You'll want to start the
process, I expect :)
oProcess.WaitForInputIdle();

BTW, this waits for a GUI message loop to start in the given
application. A program like lame (I presume it's a command-line mp3
encoder) won't have a message loop.
if (!oProcess.HasExited)
oProcess.WaitForExit();

-- Barry
 
Back
Top