DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 09 Aug 2007 05:21:40 -0700,    posted on: microsoft.public.dotnet.framework        back       

Thread Index
  1    bede
          2    Peter Duniho


exited event on process   
I start a new process which in this case will be IE with the following
code :

p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.StartInfo.FileName = tempFilename;// mydoc.xml
p.StartInfo.CreateNoWindow = false; p.Start();

I have noticed an unusual behaviour.
For some strange reason the Exited event is fired straight after IE
opens and not just when I exit. I have also noticed that when the file
type is a .doc file resulting in Word opening the Exit event doesn't
fire at all. Even when exiting Word.

To make things wierder, if I try an excel file Excel opens fine and
fires the event at the correct time.

Has anyone come across this strange behaviour ?
Date:Thu, 09 Aug 2007 05:21:40 -0700   Author:  

Re: exited event on process   
bede wrote:

> [...]
> For some strange reason the Exited event is fired straight after IE
> opens and not just when I exit. I have also noticed that when the file
> type is a .doc file resulting in Word opening the Exit event doesn't
> fire at all. Even when exiting Word.
> 
> To make things wierder, if I try an excel file Excel opens fine and
> fires the event at the correct time.
> 
> Has anyone come across this strange behaviour ?


I don't have a specific answer.  But do note that you are not specifying 
the name of an executable file, so you are at the mercy of whatever 
mechanism by which the document is mapped to a process.

Personally, I would expect _all_ of your scenarios to result in an exit 
notification once the actual application has been started.  As in the 
way that it works when the document is opened by IE.  However, it's not 
unreasonable to imagine that other document types involve slightly 
different mapping to the application, and thus slightly different behavior.

If you want a reliable method, I think you will need to somehow map the 
document to the application itself, and make sure that you are starting 
the application directly, via the executable name and whatever 
parameters are necessary.  Alternatively, it may be that there is some 
OLE mechanism by which you can open the document as an object rather 
than a process, effectively acting as a container for an embedded 
document.  That may work as well.

Pete
Date:Thu, 09 Aug 2007 10:04:28 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us