Friday 15 May 2015

c# - Process.Start("IEXPLORE.EXE") immediately fires the Exited event after launch.. why? -


I have a strange problem with IE8 installed in XP I have a system. Trying to launch IE using Diagnostics Process.Start method in C #. And I need to trap the event to get out of IE and do some operations.

  process objProcess = Process.Start ("I" IEXPLORE.EXE "," http://google.com "); if (obj process! = Null) {objProcess.EnableRaisingEvents = true ; ObjProcess.Exited + = New EventHeader (myProcess_Exited);} Public Fixed Zero myProcess_Exited (Object Sender, System.EventArgs E) {MessageBox.Show ("You Exited");}  

But the above code works perfectly when encroaching on various processes (eg: Notepad) and it removes the exiting event when the exchange is closed.

This is the only problem Let's start IE 8. Can anyone explain to me what's the problem?

UPDATE

Most friends have posted my post And why did not you just use a URL? Why should I stay with IE?

Here cause

The last purpose of the app Launch a URL from the Windows application and hide an XE when working on IE and disconnecting IE after exe Show.

Thanks

Most likely that you are already a process , So when you try to start it again as a new process, it seems that there is an already running IEEE, it states that the user started a new window (hence the initial IE will create a "new" window instead of a new one) and exit.

Possible solutions: Try starting the process with the "-nomerge" command line option:

  process Objprrocess = Process.start ( "IEXPLORE.EXE", "-nomerge http://google.com/");  

Interesting overview : objProcess.ExitCode (for at least IE8) is equal to 0 If any other frequency has passed out of control, and 1 if it was actually closed by the user.


No comments:

Post a Comment