开发者

prevent command line from opening on _popen

I'm opening a process in C++ like so

FILE* pipe = _popen(ss.str().c_str(), "r");

This create a cmd window which goes to the forefront of the desktop. I want to prevent the cmd window from opening, and if I can't, a way to keep it minimized.

Tried solutions:

HWND hWnd = GetConsoleWindow();
ShowWindow(hWnd, SW_HIDE);

But that only wor开发者_StackOverflow社区ks if you are calling that function in the process that holds the cmd window.


Instead of using _popen, use CreateProcess and the CREATE_NO_WINDOW flag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜