I am working on development of simple application launcher program which is supposed to launch from its main window several applications. One of the applications to launch is an Internet Explorer and it is supposed to be started minimized. The problem - my code works as intended only if there is no other Internet Explorer instance already running. If there is one, my application launcher starts its Internet Explorer instance in normal (not minimized) window. I am observing this behaviour only with Internet Explorer. If I modify my code to start Notepad instead of the Internet Explorer, then everyting works as intended no matter how many instances of the Notepad are already running - all new Notepad instances start minimized. Here is the relevant part of my code which in fact is very basic:
case IDC_MAIN_BUTTON5:
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWMINIMIZED;
CreateProcess(L"C:\\Program Files\\Internet Explorer\\iexplore.exe",
L"",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi);
WaitForInputIdle(pi.hProcess, 1000);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
break;
Any ideas or suggestions how to solve this strange problem would be very much appreciated.