.exe from within a form

A

Al_C

Is there a control that permits me to run an exe file inside a form?
I've tried the process.start approach and it doesn;t seem to do what I
expected. There doesn't seem to behave the way I expect (similar to a C
shell).
Two things happen. The calling program seems to go into limbo if the
process.hasexited command works, and in some cases the hasexited command
results in a TRUE condtion even when the shelled app is still running.
Would like to run these exe's in a window so I can an employ a showdialog
method.
Thanks for any suggestions,
Al
 
A

Al_C

The timer is enabled and unless I click on button1 the code works as
expected.
Once I click on button1, the code seems to shut of or ignore the
timer1_tick.
Soon as I close down the notoepad.exe the code starts working fine again
Thanks for you patience.
Al


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myProcess As New Process()
Dim myProcessStartInfo As New ProcessStartInfo("notepad.exe")
myProcess.Start()
While (myProcess.HasExited = False)
End While
End Sub


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Static Dim n As Int16
n = n + 1
Me.ProgressBar1.Value = n
If n = 100 Then
n = 0
End If
End Sub

End Class
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

The timer relies on windows messaging, if you use a "dead" loop like
that, you will lock up the messaging processing, and nothing happens
until you leave the loop.

Put a DoEvents call in the loop.
 
A

Al_C

Want to thank you both. You saved my biscuits in the last two days.
It was a combination of issues.
To start with, I did have the software in too tight a loop. Adding a
doevents
(in .net speak it's application.doevents!) solved the problem with well
behaved apps.
The other issue I had was with an app that had a .exe extension but would
produce a
..scr extension in the task manager. This is the one that acted really
strange. It would
say it had exited and it really did not.
Oddly all I had to do was to copy it to another filename with a .exe
extension and it fit
very neatly into the while !hasexited loop. But this also lead to another
finding. This app was
such a CPU hog, I actually had to put my thread to sleep for 100ms so this
app could run.
Thank you all for your help.
The boss is happy, so I'm happy. ;)
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top