Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:34:43+00:00 2026-05-25T20:34:43+00:00

I’m looking to build a task monitor/manager using the Win32 API. It will be

  • 0

I’m looking to build a task monitor/manager using the Win32 API. It will be started (preferably as a windows service) with a command line argument specifying how many instances of a new process it should start.

task_man.exe 40

Will start 40 instances of the process

task.exe

Now, whenever a task.exe exits (correctly or not), I will have to start a new one to replace it.

My rough idea is this:

Start the tasks from task_man, get their PIDs, and then have a loop that checks whether the PIDs are all active processes. For every invalid PID, start a new process and replace the old PID with the new one.

Is there a better design I can use, or a better workflow? Is there a standard method for doing this? I don’t want to reinvent the wheel… Also, which APIs should I look into?

I’m also looking for a design that is easy to change afterwards – i.e. if I run

task_man.exe 30

afterwards, a new task_man shouldn’t start running, but rather it should change the number of tasks in the previous instance. (I know it will start running, what I’m saying it should modify the original and then exit)

I’m not looking for code (as in I’m not looking for the full implementation, not that I mind looking over samples), rather what APIs I can use, or suggestions on the overall design I came up with.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:34:44+00:00Added an answer on May 25, 2026 at 8:34 pm

    The easiest way to tell if a process has exited is to wait on its handle. You can do that in a few ways:

    1. Build an array of all the process handles, and use WaitForMultipleObjects (bWaitAll being FALSE) to wait on all of them. Then, when your code continues, you’ll have to figure out which process ended, create a new one, update the array and wait again.
    2. Run 40 threads, each creating one process and infinitely waiting on its one handle (using WaitForSingleObject). Then, when that task ends, that thread will be responsible to create a new one and wait on it.
    3. If you don’t want to create 40 threads, just have one that will wait for short periods of times over each of the process handles (using WFSO), and check the return value. Your program will response slower this way, but it would be easier to recognize the process that has ended, and you won’t be creating many threads.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.