|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
To catch when a process is terminatedHi,
In my code I have the following System.diagnostics.process.start("wordpad",sFileN) And this is follow bij others codelines It seems that these other lines are executed before the process is terminated by closing this process but I don't want that. Can I write something like ? If ........ then than the other lines end if Where ...... is the code that I want to know for knowing that the process is terminated. Thanks for any response Start will tell Windoze to spawn another process within which Wordpad
executes - just like you launched it from the Start menu or something. So the command will return with a success/failure, ie. succedded in starting or failed to start - what happens next is in your code, but Wordpad is up and running. If you were using automation then that would be a different matter - you could control the startup, edit and shutdown process. The only real way to know when the process closes is to check sFileN, to see if it's in use - as long as it is in use, you can assume wordpad has control of it. You can use a timer to do this, trying to open sFileN and catching any IO exception ("file in use") you get as a result. Show quoteHide quote "andreas" <andr***@pandora.be> wrote in message news:lGujg.479669$%V4.12409968@phobos.telenet-ops.be... > Hi, > In my code I have the following > System.diagnostics.process.start("wordpad",sFileN) > And this is follow bij others codelines > It seems that these other lines are executed before the process is > terminated by closing this process but I don't want that. > Can I write something like ? > > If ........ then > than the other lines > end if > > Where ...... is the code that I want to know for knowing that the process > is > terminated. > Thanks for any response > > "andreas" <andr***@pandora.be> schrieb: \\\> In my code I have the following > System.diagnostics.process.start("wordpad",sFileN) > And this is follow bij others codelines > It seems that these other lines are executed before the process is > terminated by closing this process but I don't want that. Dim p As Process = Process.Start(...) p.WaitForExit() /// .... or set the 'Process' object's 'EnableRaisingEvents' property to 'True' and handle its 'Exited' event. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Handling DBNull from databases
Function Vs. Sub Procedure Marshal Structure containing arrays to function in DLL Final Post of the day Loopin trough colors getting screen coordinates for positioning a floating control next to a tableLayOutPanel embeded con Linking childform to Main Form in VB6 A Question About Regular Expressions and Capture Setting the Title property in a Windows File ... Tokenizing |
|||||||||||||||||||||||