2013-05-03 55 views
0

我有一个疑问,当我创建一个新进程iexplore,并且此进程打开单个页面时,我想知道该页面是否正确加载。如何知道页面加载失败?有没有办法从iexplore过程中发现错误?创建进程并附上C#

我有这样的演示代码,但不能正常工作

string navegador = "C:\\program files (x86)\\Internet Explorer\\iexplore.exe"; 
Process p = new Process(); 
p.StartInfo.FileName = navegador; 
ProcessStartInfo processStartInfo = new ProcessStartInfo(navegador); 
p.EnableRaisingEvents = false; 
p.StartInfo.UseShellExecute = false; 
p.StartInfo.RedirectStandardOutput = true; 
p.StartInfo.RedirectStandardError = true; 
p.StartInfo.CreateNoWindow = true; 
p.StartInfo = processStartInfo; 
p.StartInfo.Arguments = "google.com"; 

p.Start(); 

Process currentProcess = Process.GetCurrentProcess(); 
Process[] localByName = Process.GetProcessesByName("iexplore"); 
Process[] localAll = Process.GetProcesses(); 


p.OutputDataReceived += new DataReceivedEventHandler(
         prsProjectTypes_OutputDataReceived); 
p.BeginOutputReadLine(); 

errorMessage = p.StandardError.ReadToEnd(); 
p.WaitForExit(); 

感谢您的任何帮助。

+0

很明显,英语不是你的母语,这很好,但你的问题几乎不可能理解。 – regretoverflow 2013-05-03 19:18:37

+0

试图重述这个问题,请看看它是否更好,并且仍然反映您的任务。你能说出你想监视的确切的错误条件是什么吗? – oleksii 2013-05-03 19:40:29

回答

1

假设您正在使用WPF,您应该查看Web浏览器控件而不是启动单独的过程。这将让你访问LoadCompleted事件,这似乎是你在找什么。