Showing an info message during external application execution

L

Lonifasiko

Hi group,

I must launch from my Winforms application another application (.exe
developed by the client) which response time sometimes can be more or
less 30 seconds.

I'm using ProcessManager class and WaitForExit() to start it and wait
till it rsponds me. It's necessary for the application to get a
response, that's why I use WaitForExit().
I don't have access to the external .exe developed by the client,
therefore I've built a little console application that imitates the
behaviour and wait 30 seconds with
System.Threading.Thread.Sleep(30000). Don't know if this is the correct
way to imitate the .exe application's behaviour.

If yes, the idea is to show the user in a texbox the curren state of
the application. Therefore, before starting the process, I show him
"Starting external .exe...", then I launch the external application and
wait for its exit.

Well, all messages I want to show to user before launching the external
..exe are not shown. I want a message to be in the textbox while the
console application is being executed! And it seems like when launching
the console application my main application gets somehow blocked and do
not show any messages.

Thanks very much in advance.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Lonifasiko said:
Hi,

I did not notice about Application.DoEvents()

You would be better if you had not notice it :)

DoEvents should not be used for this kind of processing. The correct way is
to create a thread launch the app from there and inform the main thread (the
ui thread) of any changes or the completion of the execution.
Do a search in the archives of Control.Invoke you will find plenty of posts
about this.
 

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