Test for program still running that was called via Shell(xyz)

eyewonder

New member
Local time
Today, 16:45
Joined
Dec 15, 2011
Messages
9
I am calling another Windows program from within Access 97, using the Shell command. The program being called is 'dnc4u', a CNC uploading program.
I would like to wait after calling the Shell(xyz), until the 'dnc4u' program is complete.
Is there an easy way to test for that prog still running?
Cheers,
Steve
 
Thanks for the link Doc. That will be useful!
 
Un, no - I've never heard of ShellAndWait. I'll be checking it out.
Thanks, it sounds like that will work for me.
I'll report back success (or frustration).
 
I've tried (briefly) both suggested methods, & can not make them work. This function would be nice, but not essential for my program, so I'm putting it off, for a while.
Cheers
Steve
 
do they work or not?
if not why? do you have msa?
 
Try this code from Daniel Pineault:

Rich (BB code):
'---------------------------------------------------------------------------------------
' Procedure : IsAppRunning
' Author    : Daniel Pineault, CARDA Consultants Inc.
' Website   : http://www.cardaconsultants.com
' Purpose   : Determine is an App is running or not
' Copyright : The following may be altered and reused as you wish so long as the
'             copyright notice is left unchanged (including Author, Website and
'             Copyright).  It may not be sold/resold or reposted on other sites (links
'             back to this site are allowed).
'
' Input Variables:
' ~~~~~~~~~~~~~~~~
' sApp      : GetObject Application to verify if it is running or not
'
' Usage:
' ~~~~~~
' IsAppRunning("Outlook.Application")
' IsAppRunning("Excel.Application")
' IsAppRunning("Word.Application")
'
' Revision History:
' Rev       Date(yyyy/mm/dd)        Description
' **************************************************************************************
' 1         2014-Oct-31                 Initial Release
'---------------------------------------------------------------------------------------
Function IsAppRunning(sApp As String) As Boolean
    On Error GoTo Error_Handler
    
    Dim oApp As Object
 
    Set oApp = GetObject(, sApp)
    IsAppRunning = True
 
Error_Handler_Exit:
    On Error Resume Next
    Set oApp = Nothing
    Exit Function
 
Error_Handler:
    Resume Error_Handler_Exit
End Function
 

Users who are viewing this thread

Back
Top Bottom