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 7524619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:07:10+00:00 2026-05-30T03:07:10+00:00

What is the method of getting the return value from spawning a sub-process within

  • 0

What is the method of getting the return value from spawning a sub-process within windows? It looks like ShellExecute() is simpler to use than is CreateProcess(), but from the reading I’ve done thus far, neither indicate how to check the return value of the spawned process. How is that done?

Thanks,
Andy

  • 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-30T03:07:12+00:00Added an answer on May 30, 2026 at 3:07 am

    To acquire the exit code of a process on Windows you can use GetExitCodeProcess().

    Example application that accepts the process id as an argument and waits for five seconds for it to complete and then acquires its exit code:

    int main(int a_argc, char** a_argv)
    {
        int pid = atoi(*(a_argv + 1));
    
        HANDLE h = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, pid);
    
        if (NULL != h)
        {
            WaitForSingleObject(h, 5000); // Change to 'INFINITE' wait if req'd
            DWORD exit_code;
            if (FALSE == GetExitCodeProcess(h, &exit_code))
            {
                std::cerr << "GetExitCodeProcess() failure: " <<
                    GetLastError() << "\n";
            }
            else if (STILL_ACTIVE == exit_code)
            {
                std::cout << "Still running\n";
            }
            else
            {
                std::cout << "exit code=" << exit_code << "\n";
            }
            CloseHandle(h);
        }
        else
        {
            std::cerr << "OpenProcess() failure: " << GetLastError() << "\n";
        }
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What return type should one return from a method that is getting rows from
I am getting a UIColor returned from this method: - (UIColor *)getUserSelectedColor { return
I am calling a method from another method and keep getting a warning: firstViewController
Iam getting OutOfMemoryException while making remote method call. RemoteEntity.SetLocalStore(DATASET); passed value is dataset. Note
Possible Duplicate: Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application Short version:
I am having difficulty getting the bool done value from EndLoop() and moving it
I have an object which is the return value for a web service method.
Im trying to read the return value of a Java Method and save it
I tried to call simple Web Method from JSON but I am getting errors.
I have the following helper method that returns the value from a field. public

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.