Hello,
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
Thanks... 9 7628
"kimiraikkonen" <ki*************@gmail.comschrieb:
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
\\\
myProcess.WaitForExit()
....
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
On Oct 11, 12:15 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
"kimiraikkonen" <kimiraikkone...@gmail.comschrieb:
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
\\\
myProcess.WaitForExit()
...
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Yes, but i've forgotten, i don't want to use waitforexit() because it
makes my project's main form unusable/hang while external process is
in progres.
Also i want to autoamate it, i don't know it's about looping
(iteration) or other. I don't want user prompt like button click. How?
I hope explained clear enough.
On Oct 10, 3:44 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Oct 11, 12:15 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
h...@gmx.atwrote:
"kimiraikkonen" <kimiraikkone...@gmail.comschrieb:
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
\\\
myProcess.WaitForExit()
...
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Yes, but i've forgotten, i don't want to use waitforexit() because it
makes my project's main form unusable/hang while external process is
in progres.
Also i want to autoamate it, i don't know it's about looping
(iteration) or other. I don't want user prompt like button click. How?
I hope explained clear enough.- Hide quoted text -
- Show quoted text -
Set the process objects EnableRaisingEvents, and then hook it's Exited
event.
Private WithEvents myProcess As New Process()
Private Sub DoCoolStuff()
With myProcess
.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
.StartInfo.WorkingDirectory = Application.StartupPath
.StartInfo.WindowStyle = ProcessWindowStyle.Normal
.EnableRaisingEvents = True
End With
myProcess.Start()
End Sub
Private Sub ProcessExited (Byval sender As Object, ByVal e As
System.EventArgs) Handles myProcess.Exited
' do cool stuff
End Sub
Anyway, not a complete working example, but it should give you the
idea.
--
Tom Shelton
On Oct 10, 4:01 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
Hello,
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
Thanks...
Perhaps you should re-read your previous posts. Armin has already told
you how to do this and even provided a sample.... http://groups.google.com/group/micro...15f878e987caaa
Thanks,
Seth Rowe
On Oct 11, 1:55 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Oct 10, 4:01 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
Hello,
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
Thanks...
Perhaps you should re-read your previous posts. Armin has already told
you how to do this and even provided a sample....
http://groups.google.com/group/micro...languages.vb/b...
Thanks,
Seth Rowe
Seth,
Yes i know, but i couldn't manage to do. I added another "private sub
onProcess Exited..." as corrected by Visual Studio.
Then i run my project but at the end of processing, nothing happened.?
On Oct 11, 7:10 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Oct 11, 1:55 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Oct 10, 4:01 pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
Hello,
I want to automate something and display a simple msgbox that
indicates my external process finished processing and "exited".
My code is that, what things should i add more:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("bla.exe", "-b
")
psInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
psInfo.WorkingDirectory = Application.StartupPath
psInfo.WindowStyle = ProcessWindowStyle.Normal
Dim myProcess As Process =
System.Diagnostics.Process.Start(psInfo)
Thanks...
Perhaps you should re-read your previous posts. Armin has already told
you how to do this and even provided a sample....
http://groups.google.com/group/micro...languages.vb/b...
Thanks,
Seth Rowe
Seth,
Yes i know, but i couldn't manage to do. I added another "private sub
onProcess Exited..." as corrected by Visual Studio.
Then i run my project but at the end of processing, nothing happened.?- Hide quoted text -
- Show quoted text -
Did you set your process objects EnableRaisingEvetns property to
true? Otherwise, no event will be raised....
--
Tom Shelton
Did you set your process objects EnableRaisingEvetns property to
true? Otherwise, no event will be raised....
--
Tom Shelton
Tom, thanks! That's it! It fixed determining about exiting event, but
another problem:
if i want to hide my visible progess bar by coding
"progressbar1.hide()" just before MsgBox("exited") i get that error:
"Cross-thread operation not valid: Control 'ProgressBar1' accessed
from a thread other than the thread it was created on."
How can i fix it though?
Very thanks
On Oct 11, 10:15 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
Did you set your process objects EnableRaisingEvetns property to
true? Otherwise, no event will be raised....
--
Tom Shelton
Tom, thanks! That's it! It fixed determining about exiting event, but
another problem:
if i want to hide my visible progess bar by coding
"progressbar1.hide()" just before MsgBox("exited") i get that error:
"Cross-thread operation not valid: Control 'ProgressBar1' accessed
from a thread other than the thread it was created on."
How can i fix it though?
Very thanks
You must marshal control back to the form. The easiest way (imo) is to
use Me.BeginInvoke.
Here's another sample that you need to place in the code-behind of
Form1 in a new Windows Application
////////////////////
Imports System.Threading
Public Class Form1
Private progress As ProgressBar
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
progress = New ProgressBar()
progress.Location = New Point(3, 3)
Me.Controls.Add(progress)
Dim button As New Button()
button.Location = New Point(3, 30)
button.Size = New Size(75, 23)
button.Text = "Begin Work"
AddHandler button.Click, AddressOf button_Click
Me.Controls.Add(button)
End Sub
Private Sub button_Click(ByVal sender As Object, ByVal e As
EventArgs)
Dim t As New Thread(AddressOf DoTheWork)
t.Start()
End Sub
Private Sub DoTheWork()
Try
'// Do something useful
MessageBox.Show("Doing something useful")
Finally
If Me.InvokeRequired Then
Dim d As New HideProgressBarDelegate(AddressOf
HideProgressBar)
Me.BeginInvoke(d)
Else
HideProgressBar()
End If
End Try
End Sub
Private Delegate Sub HideProgressBarDelegate()
Private Sub HideProgressBar()
progress.Hide()
End Sub
End Class
////////////////////
Thanks,
Seth Rowe This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Daniel Xiao |
last post by:
I have used the following method to set the running priority for a
process and its affiliated threads. It is noticable at statement (*)
that if the process has already exited, the method will...
|
by: solex |
last post by:
Hello All,
Hopefully someone has run into this error. I have written a class(source
below) that launches a thread to monitor the StandardOutput of a
System.Diagnostics.Process, in particular I...
|
by: snicks |
last post by:
I'm trying to exec a program external to my ASP.NET app using the following
code. The external app is a VB.NET application.
Dim sPPTOut As String
sPPTOut = MDEPDirStr + sID + ".ppt"
Dim p As...
|
by: Caroline |
last post by:
I am building a web application to gather user information then launch a
process to calculate results. The process is a 3rd Party executable. I
cannot get the process to start. Is there a...
|
by: Bob |
last post by:
Process.start("Mydoc.doc") starts Word with the file. I need to wait for
Word to be closed before more code can execute in my app. How can I do this?
Thanks for any help
Bob
|
by: =?Utf-8?B?TEJU?= |
last post by:
Good day,
I would like to execute an external application from a web form created
using ASP.Net. I'm using System.Diagnostics.Process. It works fine if it is
notepad.exe but it is not able to...
|
by: Lonifasiko |
last post by:
Hi,
Using Process class I asynchronously launch an executable (black box
executable) file from my Windows application. I mean asynchronously
because I've got an EventHandler for "Exited" event....
|
by: ags5406 |
last post by:
I've a Windows Service that keeps a particular executable running. If
the executable fails for whatever reason, the Service restarts it.
Right now I'm using a loop to check if the process is...
|
by: John Halet |
last post by:
I have a application that crunches a bunch of data, creating log
files, excel files etc...
I use Process.Start to open any number of these file for viewing.
My goal is to have the application...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |