Thanks for any help
Bob
How about to use the wait for exit in the process class to wait on the exit
of that process.
:-)
http://msdn2.microsoft.com/en-us/library/fb4aw7b8.aspx
I hope this helps,
Cor
"Bob" <bdu...@sgiims.com> schreef in bericht
news:uSv4E59v...@TK2MSFTNGP04.phx.gbl...
pr.Start(Fname) where Fname is the filename to use with the process.
However I get a message in the IDE saying that Access of Shared member,
constant member.... etc. qualifying expression will not be evaluated.
Got any code snippets to do this? It seems straightforward but <GGGG> :-)
Thanks for your help.
Bob
"Cor Ligthert [MVP]" <notmyfi...@planet.nl> wrote in message
news:ev8wQ89v...@TK2MSFTNGP06.phx.gbl...
Bob - here is a simple console application that demonstrates this
method:
Option Explicit On
Option Strict On
Imports System
Imports System.Diagnostics
Module Module1
Public Sub Main()
Dim p As Process = Process.Start("notepad.exe")
p.WaitForExit()
Console.WriteLine("Done")
End Sub
End Module
This is a blocking operation... Another way to do this, whithout
blocking would be:
Option Explicit On
Option Strict On
Imports System
Imports System.Threading
Imports System.Diagnostics
Module Module1
Private WithEvents p As New Process
Private exited As Boolean = False
Public Sub Main()
p.EnableRaisingEvents = True
p.StartInfo.FileName = "notepad.exe"
p.Start()
While Not exited
Thread.Sleep(1000)
Console.WriteLine("Running!")
End While
Console.WriteLine("Done")
End Sub
Private Sub NotepadExited(ByVal sender As Object, ByVal e As
EventArgs) Handles p.Exited
exited = True
End Sub
End Module
Anwyay - HTH,
--
Tom Shelton [MVP]
Exciting
:-)
Cor
"Tom Shelton" <t...@mtogden.com> schreef in bericht
news:1155659311....@74g2000cwt.googlegroups.com...
How could I end up gettng Word to open up and have to wait before going back
to my application form that the process is closed. I look at the docs and I
see that Waitforexit does interrupt the calling thread and this is indeed
whats needed. I just don't see how to code it.
Any help is really, really appreciated.
Bob
"Tom Shelton" <t...@mtogden.com> wrote in message
news:1155659311....@74g2000cwt.googlegroups.com...
>
Bob - the example I wrote works fine for me... With word as well. I
just tested it here with word to be certain.
The call to process.start returns an instance of the process class, so
there is no shared methods involved. You do not call this on the
Process class, but on the instance returned by the Process.Start
method.
I think what we need is the shortest snippet of ACTUAL code that
demonstrates the issue, since I can not replicate this problem.
--
Tom Shelton [MVP]