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. Being notified of app running

Being notified of app running

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 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.
  • D Offline
    D Offline
    De Nardis Andrea
    wrote on last edited by
    #1

    Hi all, does anyone know hot to be notified if a .exe file start running? I both need it for regular applications and services, too, but I think the solution could be the same. Basically I would need of a signaled event when the monitored .exe is start running for app. I would also need a signaled event when some changes happen in the services controlled by the Service Control Manager. Thanx in advance. Regards, Andrea

    J 1 Reply Last reply
    0
    • D De Nardis Andrea

      Hi all, does anyone know hot to be notified if a .exe file start running? I both need it for regular applications and services, too, but I think the solution could be the same. Basically I would need of a signaled event when the monitored .exe is start running for app. I would also need a signaled event when some changes happen in the services controlled by the Service Control Manager. Thanx in advance. Regards, Andrea

      J Offline
      J Offline
      Joan M
      wrote on last edited by
      #2

      There are a lot of methods to do this... here two of them (possibly not the best of them, but the ones I know ;) ) 1. You can use findwindow in time intervals in order to know if your app is there, this is an easy trick, but it can be a problem if your app hungs. 2. your app can lock a dummy file and the others can monitor that file state, if it is locked your app is running... Hope this helps.

      https://www.robotecnik.com freelance robots, PLC and CNC programmer.

      D 1 Reply Last reply
      0
      • J Joan M

        There are a lot of methods to do this... here two of them (possibly not the best of them, but the ones I know ;) ) 1. You can use findwindow in time intervals in order to know if your app is there, this is an easy trick, but it can be a problem if your app hungs. 2. your app can lock a dummy file and the others can monitor that file state, if it is locked your app is running... Hope this helps.

        D Offline
        D Offline
        De Nardis Andrea
        wrote on last edited by
        #3

        Hi Joan, unfortunately these solutions have a counterpart: they need CPU time for testing! I need something more efficient... Regards, Andrea

        J 1 Reply Last reply
        0
        • D De Nardis Andrea

          Hi Joan, unfortunately these solutions have a counterpart: they need CPU time for testing! I need something more efficient... Regards, Andrea

          J Offline
          J Offline
          Joan M
          wrote on last edited by
          #4

          yes, of course those solutions need CPU, but how do you want to be sure that the app is going on without looking for it often? Imagine that you send a message from your app to the "controller" (I'll call controller to the application that needs to know if your app is active) when your app starts, and another when your app stops... If you can ensure that your app won't hung and that the controller is started before the app, this could be a good solution, think about a button (or something similar in your controller in order to kill the flag (only in case that your app hungs)). Remember not to use FindWindow (if your app can hung, this could make the controller hung also). Think about: what could happen if your controller was not started before the app? For this reason I thought on the file locking method... (that sacrifices some CPU making the controller looking after that, but gives you almost all the control needed. I've used that in order to make two controlling services to know about if my app was running, if my app, or one of the services was stopped the computer immediately stopped... (this was done in a console computer environment (a computer programmed to move a machine)). If you don't need to know about the state of your app. you can use the sending of messages, cheap and easy. Think about a messages protocol that allow the two apps to communicate... hope this helps...

          https://www.robotecnik.com freelance robots, PLC and CNC programmer.

          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