I am developing a WinForm application which will redirect theuser to HTML page, using IE, when they click a button. However,I want this to be modal in operation, so I would like to makesure that the IE process has finished before I allow then tocontinue.
I first tried using the WaitForExit method of the Process class,but this returns an error while IE is still showing the HTMLpage. Is there any way that I can ensure the page is closedbefore allowing the user to continue?
If possible, I would like to stay away from using an embeddedbrowser control as this looks a little bit too complex for whatI am trying to achieve.
A code sample is below
ProcessStartInfo startupInfo = new ProcessStartInfo ();
startupInfo.FileName = filePath;
startupInfo.UseShellExecute = true;
startupInfo.CreateNoWindow = true;
Process process = Process.Start (startupInfo);
process.WaitForExit();
The filePath variable is the fully qualified path to a HTMLdocument. By the time the WaitForExit is called, an Objectreference not set exception is thrown.
Thanks in advance
--------------------------------
From: Stephen Haeney
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>bDHb7PEolkeYII48FfKj9Q==</Id>