Is there a function to tell if a specific application is running?

Is there a function to tell if a specific application is running?

Is there a function to tell if a specific application is running?

I would like to pass the application executable name and get back true or false to say if it is running.

Or maybe something like the Windows task manager that gives a list of processes running.

Is there anything like that in CVF?

Thanks,

David

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

In CVF? I doubt it, but what you want is available from the Win32 API. Life is easier if the application you're looking for has a top level window; use FindWindow or EnumWindows api functions. If not, then EnumProcesses may be the ticket, but the path will be harder. See MSDN docs (either installed with CVF or on the web) for more on these functions. You may also want to to see MS KB article Q175030 - HOWTO: Enumerate Applications in Win32

hth,
John

David

If you don't want to mess with Windows APIs, I've had pretty good success by using the Fortran file system to signal between applications. When the application you want to check for starts, just have it open a file, write a single character to it, and then close it (STATUS='KEEP'). Other processes can check for the file's existence with an INQUIRE (FILE=...) and determine if the first application is operating. Of course, the monitored application needs to close and delete the file before it STOPs.

This method has the advantage of being portable and does not depend on the operating system, computer hardware, or compiler you are using.

John

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen