I'm writing a web testing framework for windows that uses multiple browsers to test web apps. I want to launch the browsers hidden but it's not working.
I'm using CreateProcess to start the browsers with the SW_HIDE flag
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
CreateProcess(NULL, const_cast<char*> (cmd.c_str()) , NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
It works fine for internet explorer and other apps, but fails with firefox and other browsers. I'm aware that a process is able to choose whether or not to follow the passed flags. Is there any way i can force it to start hidden?
I can probably wait until the window shows up and then hide it by getting a handle to the open window. But I'm looking for cleaner solution.