Process Hanging

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello ,

I am developping a program for Win98 plateform, and I am stucking with a
problem, hope you can help me.

I have a program running 2 process :
- One process running the Xcopy.exe
- When the first process is finished, it runs another Exe process (HHC.exe)

The code is below:

// Process 1: Xcopy.exe to copy directory 1 to 2

compiler.StartInfo.FileName = "Xcopy.exe";
compiler.StartInfo.Arguments = Dir1 + Dir2 + " " + "/S /Y";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.CreateNoWindow = true;
compiler.Start();

while (!compiler.HasExited)
{
Application.DoEvents();
{

// Process 2: Recompilation the new CHM with Hhc.exe external command
compiler.StartInfo.FileName = Dir 2 + "\\" + "hhc.exe";
compiler.StartInfo.Arguments = Dir2 + "\\" + "Help.hhp";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.CreateNoWindow = true;
compiler.Start();

while (!compiler.HasExited)
{
Application.DoEvents();
}


My problem is that, when I run this program in Windows 98, the Xcopy process
runs in the black window and it hangs, the process 2 cannot be run until I
manually close it command window
The same program works fine in WinXP or 2000

Do you have a clue of what' s going on ?, how can I avoid this Xcopy black
screen to appear in win98 ?

thanks for your help

S
 
Hi Samantha,,

Did you try yor xcopy command with all the needed parameter in win98 machine
manually..

becos I know win 98 has two command xcopy and *XCOPY32.EXE* may be there may
have some link here.. so first try the command manually in ur windows box
and see whether actaully it works..

Regards,
Nirosh.
 
second... in between these argumanet Dir1 and Dir2 I don't see a space how
this really work in XP and 2000..

I think you are missing some thing here..

Nirosh.
 
Hello Nirosh,

"> second... in between these argumanet Dir1 and Dir2 I don't see a space how
this really work in XP and 2000.."

There is a space at the end of Dir1, I run the command manually, it works
great. actually, when the program runs, it' s actually work because it show
up the Xcopy windows with the files being copied and there numbers, but this
black windows is not closing so the next process cannot be run.

Why the Xcopy window show up and not disappear after finishing his job ?

Regards

S.
 
Try this...
System.Diagnostic.Process myPorc = compiler.Start();

When ever it is done..

// Close process by sending a close message to its main window.
myPorc.CloseMainWindow();
// Free resources associated with process.
myPorc.Close();

Regards,
Nirosh.
 
thanks Nirosh,

I have tried your solution, but the compilation gives error at this line:
System.Diagnostic.Process myPorc = compiler.Start();

error message: cannot convert type bool to System.Diagnostic.Process.

compiler.Start() return a boolean value and it cannot this value to
System.Diagnostic.Process....how can it be done ?

regards

S
 
Hi Samantha,

Yes you got to use some other overload to have it.. may be you can try to
pass the startinfo object to the start method as a parameter, that will
return the reference of the active process. Or else just try to call
compiler.CloseMainWindow();

Second is try to use compiler.WaitForExit() Method to replace

while (!compiler.HasExited)
{
Application.DoEvents();
}

Note: Since this is a uncommon issue you got to try different ways to find a
work around.. so just go to msdn and have a look at
System.Diagnostic.Process class and it's memebers..

Regards,
Nirosh.
 
Back
Top