Determining if a file is running
-
I'm moving some 16-bit Windows code over to 32-bit and one function that is giving me problems is a function that determines if a given filename is executing. More specifically, this program updates executables and DLLs from the network and before it performs a file copy, it calls a function called ProgramRunning(szFileName). Using TASKENTRY (which doesn't exist in 32-bit land) they enumerate the running processes and see if the filename passed in is in the tasklist. Is there anyway to do something like this in 32-bit? It's easy if you have a process handle, but all I have is a damn filename. Thanks, Bill http://www.ratebeer.com
-
I'm moving some 16-bit Windows code over to 32-bit and one function that is giving me problems is a function that determines if a given filename is executing. More specifically, this program updates executables and DLLs from the network and before it performs a file copy, it calls a function called ProgramRunning(szFileName). Using TASKENTRY (which doesn't exist in 32-bit land) they enumerate the running processes and see if the filename passed in is in the tasklist. Is there anyway to do something like this in 32-bit? It's easy if you have a process handle, but all I have is a damn filename. Thanks, Bill http://www.ratebeer.com
AFAIK, There's no solution for all 32-bit Windows versions. On Win9x and 2K you can use Process32First/Next. If you need to support NT4, you'll probably have to use EnumProcesses (which is also available on 2K, but not on 9x). Tomasz Sowinski -- http://www.shooltz.com
-
I'm moving some 16-bit Windows code over to 32-bit and one function that is giving me problems is a function that determines if a given filename is executing. More specifically, this program updates executables and DLLs from the network and before it performs a file copy, it calls a function called ProgramRunning(szFileName). Using TASKENTRY (which doesn't exist in 32-bit land) they enumerate the running processes and see if the filename passed in is in the tasklist. Is there anyway to do something like this in 32-bit? It's easy if you have a process handle, but all I have is a damn filename. Thanks, Bill http://www.ratebeer.com
HOWTO: Enumerate Applications in Win32 KB: Q175030 I think that will answer your question(s).
-
AFAIK, There's no solution for all 32-bit Windows versions. On Win9x and 2K you can use Process32First/Next. If you need to support NT4, you'll probably have to use EnumProcesses (which is also available on 2K, but not on 9x). Tomasz Sowinski -- http://www.shooltz.com
Process32First/Next were exactly what I was looking for. I'm about 99% certain that we'll never be running on NT4 (it's an inhouse application) so this should work perfectly. Thanks so much! Bill http://www.ratebeer.com