I'm running this code.
SHELLEXECUTEINFO ExecuteInfo = { 0 };
ExecuteInfo.cbSize = sizeof(ExecuteInfo);
ExecuteInfo.fMask = 0;
ExecuteInfo.hwnd = nullptr;
ExecuteInfo.lpVerb = L"open";
ExecuteInfo.lpFile = L"C:\\progra~1\\intern~1\\iexplore.exe";
ExecuteInfo.lpParameters = L"http://www.google.co.uk";
ExecuteInfo.lpDirectory = nullptr;
ExecuteInfo.nShow = SW_SHOW;
ExecuteInfo.hInstApp = nullptr;
ShellExecuteEx(&ExecuteInfo);
Sleep(5000);
CloseWindow((HWND)ExecuteInfo.hwnd);
exit(GetLastError());
It's not closing the window.
And it's exiting with code 1400 (invalid window handle)
Any idea's what I'm doing wrong?