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.
精彩评论