Process Issue

  • Thread starter Thread starter Barry
  • Start date Start date
B

Barry

Hi

I have a console application which start a Windows Application, how will i
know when the Windows Application has finished processing (it basically
downloads some web info), i want to kill the Windows application when the
download completes.

I tried Proces.WaitForInputIdle() without any success.

TIA
Barry
 
Hi,

You mean that the win app does stop by itself at the end of the
processing and you want to detect when it is done ?
Can't you get a more formal way to know it (a file on the disk, ?) ?

Barry wrote :
 
Barry said:
I have a console application which start a Windows Application, how will i
know when the Windows Application has finished processing (it basically
downloads some web info), i want to kill the Windows application when the
download completes.

I tried Proces.WaitForInputIdle() without any success.

You haven't offered enough specifics, not even what specifically about
WaitForInputIdle() didn't accomplish what you wanted (for example, did
it return immediately? did it never return?), to allow any accurate advice.

However, I will suggest that the best solution would be if you could get
the Windows application, via some command line switch or something for
example, to just exit on its own when it's done. Then you could use the
WaitForExit() method or the Exited event in the Process class to monitor
the application.

If the application doesn't offer that, and you really must shut it down
explicitly, then the exact means of doing so will depend a lot on the
application and how it manages the download.

All that said, you also aren't specific about what sort of "web info"
this application is downloading, but assuming it's actually talking to
an HTTP server as the phrase "web info" suggests, you may be better off
just implementing the download in your own application, using the
HttpWebRequest class for example.

Pete
 
Thank you gus for your replies.

The Windows app is a Third-Party application and i have very control over it
(it has a GUI)

I do agree that the best way if to download the webpages programmatically,
but that would make the project unviable (financially) for me to develop and
test.
 
Barry said:
Thank you gus for your replies.

The Windows app is a Third-Party application and i have very control over it
(it has a GUI)

What third-party application is it? And what exactly does it do that
you don't want to implement yourself?
I do agree that the best way if to download the webpages programmatically,
but that would make the project unviable (financially) for me to develop and
test.

Suit yourself. Granted, you really haven't provided much detail on what
you're doing, and maybe in spite of your comments your task is more
complicated than simply downloading web pages. But if it's not more
complicated than that, the HttpWebRequest class is WAY easier to use
than trying to figure out how to shoe-horn some third-party application
into your own application.

Pete
 
I use a application named Grab A Site to download webpages for offline
browsing, it has command line otions to start, but i need to download
atleast 90 sites (urls) which can only be started with a new instance of the
application.
 
Barry said:
I use a application named Grab A Site to download webpages for offline
browsing, it has command line otions to start, but i need to download
atleast 90 sites (urls) which can only be started with a new instance of
the application.

Have you looked into the wget or curl apps/libraries?

Regards,

Mads

--
Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34
 
Back
Top