Invoke iexplore.exe in an already running instance using ShellExecuteEx

I used ShellExecuteEx to call iexplore.exe . Whenever I launch the application, a new instance of the Internet browser is created, regardless of whether it is open or not. Internet Explorer is already open or not.

I want to change this, if you already have an instance of Internet Explorer, I need to open a new tab in this instance with the address that I pass to ShExecInfo.lpParameters , thus not creating a new window. Is there any way to do this? Please advice.

UPADATE: In the answer below, I have a problem, when I set the lpFile parameter as "iexplore.exe" and lpParameters as "www.google.com", two windows open. If I ignore the lpfile parameter, the code below opens the default browsers on some machines. I want to open only Internet Explorer. please, help..

 int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { ShellExecute(0,L"open",L"iexplore.exe", L"http://www.google.com",0,SW_SHOWDEFAULT ); ShellExecute(0,L"open", L"iexplore.exe", L"http://www.yahoo.com",0,SW_SHOWDEFAULT ); return 0; } 
+4
source share
1 answer

Works with ShellExecute .

 #include <stdio.h> #include <tchar.h> #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { ShellExecute(0,L"open",L"http://www.google.com",0,0,SW_SHOWDEFAULT ); ShellExecute(0,L"open",L"http://www.yahoo.com",0,0,SW_SHOWDEFAULT ); return 0; } 
+7
source

All Articles