Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default How do I tell when a Shelled Process ends?

I've an application that starts an FTP call with the Shell Command which
sends its output to a file. The Shell command of course returns a Process
Id number. There is probably a way to use this Process Id to figure out
that process is finished, so I can collect the output and go on with the
program. But I don't know how.

One obvious way is to wait for the file that was output to be found by a Dir
command. By that process seems to hang sometimes. So I thought I'd see if
there was a way go figure out if the process was finished directly.

Anyone out there know how to do this?

Thanks,
Mac


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I tell when a Shelled Process ends?


"Mac Lingo" wrote in message
et...
I've an application that starts an FTP call with the Shell Command which
sends its output to a file. The Shell command of course returns a Process
Id number. There is probably a way to use this Process Id to figure out
that process is finished, so I can collect the output and go on with the
program. But I don't know how.

One obvious way is to wait for the file that was output to be found by a
Dir command. By that process seems to hang sometimes. So I thought I'd
see if there was a way go figure out if the process was finished directly.

Anyone out there know how to do this?


The easiest way I've found is to create a Windows shell object and execute
its Run method which has a third param that you can use to tell it only to
return to processing when the shelled operation has finished.
http://msdn2.microsoft.com/en-us/library/d5fk67ky.aspx

Sub test()
Const HIDE_WINDOW As Long = 0
Dim objShell As Object
Set objShell = CreateObject("WScript.Shell")
objShell.Run "C:\test.bat", HIDE_WINDOW, True
Set objShell = Nothing
End Sub

HTH

Rob

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
filter using "ends with" and 3 choices? Ex: ends with 1,2 or3 Debbie Excel Worksheet Functions 1 April 6th 07 12:07 AM
+(-)ve values ends in Dr(Cr) sasikumar Excel Programming 3 June 25th 06 03:30 PM
How to count process running time ( process not finished) miao jie Excel Programming 0 January 13th 05 09:23 AM
How to count process running time ( process not finished) miao jie Excel Programming 2 January 12th 05 06:01 AM
Loop never ends Anson[_2_] Excel Programming 0 June 30th 04 06:08 PM


All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"