What is the difference between DETACH_PROCESS and CREATE_NO_WINDOW process creation flags for createProcess function

后端 未结 1 1972
别跟我提以往
别跟我提以往 2021-01-11 13:27

I have been trying to understand the difference between these two process creation flags. The msdn documentation is not clear about the distinction.

  • Does CREA
相关标签:
1条回答
  • 2021-01-11 14:07

    The difference is in what the started process can do. In both cases it won't have a console. But with the CREATE_NO_WINDOW option it can call AttachConsole(ATTACH_PARENT_PROCESS) and get access to the parent's console window (if available). That explicitly will not work when you specify DETACH_PROCESS. The only option then is for the started process to use AllocConsole() to create its own console.

    Or in other words, you can be sure that the started process will never be able to chatter into your own console by using DETACH_PROCESS.

    0 讨论(0)
提交回复
热议问题