Share via

Replacement for _spawnl()

Don Dilworth 211 Reputation points
2020-11-13T13:06:29.917+00:00

I have migrated from VS2010 to VS2017, and find that _spawnl is no longer supported.

I use _spawnl to launch additional instances of my code, and I save the handle that it returns so I can test if the process has finished or to kill it if necessary.

What feature do you recommend to use instead? I can use CreateProcessA(), but that does not return a handle. How do I get that?

Or is there another feature I should used?

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


Answer accepted by question author

Don Dilworth 211 Reputation points
2020-11-13T16:42:16.397+00:00

Yes, I tried, and the return code was always an error.

But, no matter. I have managed to get CreateProcess() to work, so this problem is solved.

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Don Dilworth 211 Reputation points
    2020-11-13T17:21:12.973+00:00

    It did not. I switched to CreateProcess(), and it works now.

    Was this answer helpful?

    0 comments No comments

  2. Don Dilworth 211 Reputation points
    2020-11-13T16:37:09.983+00:00

    I don't know what UWP means. My program runs on Windows.

    Was this answer helpful?


  3. Don Dilworth 211 Reputation points
    2020-11-13T16:18:23.347+00:00

    I would love to keep using _spawnl(). But here is what is now the case:

    Important

    This API cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported in Universal Windows Platform apps.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.