How to launch console application using CreateProcess with Minimized main window

I have a native c++ windows application that is launching two child processes using the following code -

if (!CreateProcess(NULL, // No module name (use command line)
    cmdLine, // szCmdline, // Command line
    NULL, // Process handle not inheritable
    NULL, // Thread handle not inheritable
    false, // Set handle inheritance to FALSE
    CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS // Process Create Flags
    NULL, // Use parent's environment block
    NULL, // workingDir, // Use parent's starting directory
    &si, // Pointer to STARTUPINFO structure
    &pi) // Pointer to PROCESS_INFORMATION structure

with all parameters in STARTUPINFO block 0. This code works fine in launching the processes. However, I need to be able to launch the windows c++ console applications with their windows minimized.

If I add CREATE_NO_WINDOW to the Process Create Flags, I can launch the processes without any windows. This will be unacceptable.

In my research, there does not appear to be a way force a console application to open in a minimized mode. Is this correct?

Yes, I know that I could minimize the child application windows from within their own process, however, the other programmers on the team prefer not to do this.

5
задан photo_tom 7 December 2010 в 19:06
поделиться