Process.WaitForExit and Windows 98 Problem

J

John Crouse

I am using the following code sucessfully on Windows 2000 and Windows XP.
However, in WIndows 98 it seems to hang on the WaitForExit. What are my
options here?

MsgBox("Please be patient. This operation could take a minute or two
to complete.", MsgBoxStyle.Information, "CPViewer")

Me.Cursor = Cursors.WaitCursor

Dim p As New System.Diagnostics.ProcessStartInfo

p.CreateNoWindow = True

p.WindowStyle = ProcessWindowStyle.Hidden

p.FileName = strInput

p.UseShellExecute = True

'Dim pr As System.Diagnostics.Process =
System.Diagnostics.Process.Start(p)

Dim pr As Process = Process.Start(p)

'Start = Microsoft.VisualBasic.DateAndTime.Timer

'Finish = Start + 120.0

'Do While Microsoft.VisualBasic.DateAndTime.Timer < Finish

'Loop

pr.WaitForExit()

pr.Close()

pr.Dispose()

Me.Cursor = Cursors.Default


Thank you,
John
 
C

Cor Ligthert

John,

I do not know this problem, however when you get no better answer maybe than
you can try to catch the standardoutput at the end as a work around (I do
not know if this works better before you misunderstand me. When you try it
and it does, tell it than to us?)

\\\
Dim p As New Process
dim pi as new processstartinfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = myargumentstring
pi.WorkingDirectory = myworkdirectorystring
pi..FileName =C:\myprogram
pi.startinfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
///

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top