Try this:
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(cb);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
if(::CreateProcess(
NULL, _T("\"C:\\Program File\\Internet Explorer\\IExplore.exe\" http://www.google.com"), NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi, {
::WaitForInputIdle(pi.hProcess, 10000);
DWORD dwProcessId = 0;
HWND hWndMain = NULL;
HWND hWnd = ::GetWindow(::GetDesktopWindow(), GW_CHILD);
while(NULL != hWnd)
{
DWORD dwThreadId =
::GetWindowThreadProcessId(hWnd, &dwProcessId);
if((dwThreadId == processInfo.dwThreadId) &&
(dwProcessId == processInfo.dwProcessId))
{
const int nMaxCount = 256;
TCHAR pszClassName[nMaxCount];
::GetClassName(hWnd, pszClassName, nMaxCount);
if(!_tcsicmp(pszClassName, _T("find out the window class of IE using spy")))
{
hWndMain = hWnd;
break;
}
}
hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
}
if(hWndMain) ::ShowWindow(hWndMain, SW_HIDE);
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
}