Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Determining if a file is running

Determining if a file is running

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadminquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    billb2112
    wrote on last edited by
    #1

    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

    T J 2 Replies Last reply
    0
    • B billb2112

      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

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • B billb2112

        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

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        HOWTO: Enumerate Applications in Win32 KB: Q175030 I think that will answer your question(s).

        1 Reply Last reply
        0
        • T Tomasz Sowinski

          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

          B Offline
          B Offline
          billb2112
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups