CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    15

    QUERY: How to control external exe & read it's process details

    I would like to create a service or background running program (something that minimizes to system tray).

    It would have a path list of external applications, eg.

    - C:\App1\Task1.exe
    - C:\App2\Task2.exe
    - C:\App3\Task3.exe

    It would start the first one and monitor the process details (CPU Usage, Mem Usage, and maybe I/O Writes). Each application will do their jobs for a couple of minutes then go idle - hence completed the task. At this point the CPU Usage = 0, Mem Usage, etc. will be idle.

    Then I need to close/kill that process and start the next application in the list. And this repeats as above and so on.

    Does anyone know how to execute an external program, monitor the process details, then kill it?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: QUERY: How to control external exe & read it's process details

    Are you trying to reinvent the Mark Russinovich's Process Explorer?

    Well, the simplest task is "to execute an external program" - just use CreateProcess API.
    To "dirty" terminate the program - TerminateProcess (but first try to PostMessage(WM_CLOSE) to its main window if it is a window application)
    ...
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: QUERY: How to control external exe & read it's process details

    ... and for monitoring process activity you can use performance counters.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured