Saeed
November 20th, 2008, 08:05 PM
invoking winword process from the main thread , then wanna continue when the process has been closed (died)
I not sure if i m setting all the parameters correctly or not.
do u see anything obvious why while WINORD is still live it detects it not to be running?
Cheers
System.Diagnostics.Process proc = new System.Diagnostics.Process();
bProcessDone = 0;
proc.StartInfo.FileName = "winword";
proc.StartInfo.Arguments = pfile;
proc.EnableRaisingEvents = false;
proc.Start();
Thread.Sleep(2000);
bool bFound = false;
for(;;)
{
Process[] allProcs = Process.GetProcesses();
foreach (Process thisProc in allProcs)
{
if (proc.Id == thisProc.Id)
{
bFound=true;
}
}
if (bFound)
{
bFound = false;
continue;
}
else
{
break;
}
}
// shoudl not be here if the process is still running but it is
I not sure if i m setting all the parameters correctly or not.
do u see anything obvious why while WINORD is still live it detects it not to be running?
Cheers
System.Diagnostics.Process proc = new System.Diagnostics.Process();
bProcessDone = 0;
proc.StartInfo.FileName = "winword";
proc.StartInfo.Arguments = pfile;
proc.EnableRaisingEvents = false;
proc.Start();
Thread.Sleep(2000);
bool bFound = false;
for(;;)
{
Process[] allProcs = Process.GetProcesses();
foreach (Process thisProc in allProcs)
{
if (proc.Id == thisProc.Id)
{
bFound=true;
}
}
if (bFound)
{
bFound = false;
continue;
}
else
{
break;
}
}
// shoudl not be here if the process is still running but it is