Software Archive
Read-only legacy content
17061 Discussions

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

davidgraham
Beginner
506 Views
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
0 Kudos
2 Replies
Intel_C_Intel
Employee
506 Views
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
0 Kudos
Intel_C_Intel
Employee
506 Views
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
0 Kudos
Reply