Windows 调用CreateProcess()时如何在控制台上隐藏命令行字符串?

Windows 调用CreateProcess()时如何在控制台上隐藏命令行字符串?,windows,Windows,我的程序在内部分叉子进程来处理防止主进程可能崩溃的任务。当使用命令行Worker.exe MyArg1 MyArg2调用CreateProcess()时,整个字符串将显示在控制台上。这个内部流程分支并不重要,我想对用户隐藏它 下面是它的名称 wchar_t* wcsCommandLine[260] = L"Worker.exe MyArg1 MyArg2" STARTUPINFO info = {}; info.cb = sizeof info; PROCESS_INFORMATION pi =

我的程序在内部分叉子进程来处理防止主进程可能崩溃的任务。当使用命令行
Worker.exe MyArg1 MyArg2
调用
CreateProcess()
时,整个字符串将显示在控制台上。这个内部流程分支并不重要,我想对用户隐藏它

下面是它的名称

wchar_t* wcsCommandLine[260] = L"Worker.exe MyArg1 MyArg2"
STARTUPINFO info = {};
info.cb = sizeof info;
PROCESS_INFORMATION pi = {};
DWORD dwCreateFlags = 0;

BOOL bCreateProc = ::CreateProcessW(
     nullptr,              // lpApplicationName
     wcsCommandLine,
     0,                    // lpProcessAttributes
     0,                    // lpThreadAttributes
     TRUE,                 // bInheritHandles
     dwCreateFlags,
     0,                    // lpEnvironment
     0,                    // lpCurrentDirectory
     &info,
     &pi);
试用版1
dwCreateFlags

我已尝试在
dwCreateFlags
中添加
CREATE\u NEW\u控制台
CREATE\u NO\u窗口
。尽管子提示的行为不同,但它仍然显示命令行字符串

试验2

在调用
CreateProcess()
之前,我添加了
系统(“@echo off”)
,它也不起作用

输出

Progress: 0.23
Progress: 0.24
Worker.exe MyArg1 MyArg2      <-- Want to hide this

Progress: 0.25
Progress: 0.27
ProWorker.exe MyArg1 MyArg2   <-- Want to hide this
gress: 0.29
进度:0.23
进展:0.24

Worker.exe MyArg1 MyArg2
CreateProcess
从不将任何内容打印到stdout或stderr,必须有其他东西打印它,很可能是您自己的代码中的
printf
cout
调用。

CreateProcess
从不将任何内容打印到stdout或stderr,必须有其他东西打印它,很可能是
printf
cout
调用您自己的代码。

我这里没有
c标志
应用。好像是
c++
对不起,伙计们。这是一个调试问题。这太尴尬了。我不喜欢这里的东西
c flag
apply。好像是
c++
对不起,伙计们。这是一个调试问题。太尴尬了。