Click here to Skip to main content
15,921,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with HasExited and WaitForExit() Pin
PIEBALDconsult8-Feb-08 9:40
mvePIEBALDconsult8-Feb-08 9:40 
GeneralRe: Problem with HasExited and WaitForExit() [modified] Pin
danielhasdibs8-Feb-08 9:37
danielhasdibs8-Feb-08 9:37 
GeneralRe: Problem with HasExited and WaitForExit() [modified] Pin
PIEBALDconsult8-Feb-08 9:48
mvePIEBALDconsult8-Feb-08 9:48 
GeneralRe: Problem with HasExited and WaitForExit() Pin
PIEBALDconsult8-Feb-08 10:02
mvePIEBALDconsult8-Feb-08 10:02 
GeneralRe: Problem with HasExited and WaitForExit() Pin
danielhasdibs8-Feb-08 10:09
danielhasdibs8-Feb-08 10:09 
GeneralRe: Problem with HasExited and WaitForExit() Pin
PIEBALDconsult8-Feb-08 10:48
mvePIEBALDconsult8-Feb-08 10:48 
GeneralRe: Problem with HasExited and WaitForExit() Pin
danielhasdibs8-Feb-08 10:14
danielhasdibs8-Feb-08 10:14 
GeneralRe: Problem with HasExited and WaitForExit() [modified] Pin
DaveyM698-Feb-08 11:18
professionalDaveyM698-Feb-08 11:18 
After
danielhasdibs wrote:
WordProcess = System.Diagnostics.Process.Start(psi);

add
WordProcess.StandardOutput.ReadToEnd();

Works on my system (no need for the WaitForExit method call).
For some reason the Exited event isn't raised but the HasExited property is correctly set.

This is working...
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
            psi.RedirectStandardOutput = true;
            psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
            psi.UseShellExecute = false;
            psi.Arguments = "Help.txt";
            psi.FileName = "C:\\Program Files\\Microsoft Office\\Office12\\WINWORD.EXE";

            System.Diagnostics.Process WordProcess = new System.Diagnostics.Process();
            WordProcess.EnableRaisingEvents = true;
            WordProcess = System.Diagnostics.Process.Start(psi);
            WordProcess.StandardOutput.ReadToEnd();
            Console.WriteLine(WordProcess.HasExited);
            System.Diagnostics.Process.Start("Explorer.exe", "http://google.com");


Dave

modified on Friday, February 8, 2008 5:27 PM

GeneralRe: Problem with HasExited and WaitForExit() Pin
Luc Pattyn8-Feb-08 11:30
sitebuilderLuc Pattyn8-Feb-08 11:30 
GeneralRe: Problem with HasExited and WaitForExit() [modified] Pin
DaveyM698-Feb-08 11:38
professionalDaveyM698-Feb-08 11:38 
GeneralRe: Problem with HasExited and WaitForExit() Pin
Luc Pattyn8-Feb-08 11:46
sitebuilderLuc Pattyn8-Feb-08 11:46 
GeneralRe: Problem with HasExited and WaitForExit() Pin
DaveyM698-Feb-08 11:54
professionalDaveyM698-Feb-08 11:54 
GeneralRe: Problem with HasExited and WaitForExit() Pin
Guffa8-Feb-08 12:41
Guffa8-Feb-08 12:41 
GeneralRe: Problem with HasExited and WaitForExit() Pin
engsrini8-Feb-08 13:20
engsrini8-Feb-08 13:20 
GeneralRe: Problem with HasExited and WaitForExit() Pin
mav.northwind8-Feb-08 20:07
mav.northwind8-Feb-08 20:07 
GeneralRe: Problem with HasExited and WaitForExit() Pin
PIEBALDconsult9-Feb-08 4:36
mvePIEBALDconsult9-Feb-08 4:36 
GeneralRe: Problem with HasExited and WaitForExit() Pin
danielhasdibs11-Feb-08 3:43
danielhasdibs11-Feb-08 3:43 
GeneralRe: Problem with HasExited and WaitForExit() Pin
Martin#11-Feb-08 23:50
Martin#11-Feb-08 23:50 
GeneralWindows Mobile GPS Application Issue Pin
Simerjots8-Feb-08 6:55
Simerjots8-Feb-08 6:55 
GeneralRe: Windows Mobile GPS Application Issue Pin
Gareth H8-Feb-08 9:00
Gareth H8-Feb-08 9:00 
GeneralRe: Windows Mobile GPS Application Issue Pin
Simerjots8-Feb-08 9:15
Simerjots8-Feb-08 9:15 
GeneralRe: Windows Mobile GPS Application Issue Pin
Simerjots8-Feb-08 14:20
Simerjots8-Feb-08 14:20 
General[Message Deleted] Pin
bruze8-Feb-08 5:42
bruze8-Feb-08 5:42 
GeneralRe: How to voice xml wave file srored in folder using c# aspx. Pin
Bert delaVega8-Feb-08 5:59
Bert delaVega8-Feb-08 5:59 
GeneralRe: [Message Deleted] Pin
engsrini8-Feb-08 13:38
engsrini8-Feb-08 13:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.