ShellExecute with new instance
-
Hi All, I am trying to open a web page using the following code.
ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);
It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.
-
Hi All, I am trying to open a web page using the following code.
ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);
It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.
You will have to retrieve the path to the default browser and directly execute it, passing in the URL as a parameter.
ShellExecute(this->m_hWnd, _T("open"), pathToBrowser, _T("www.xyz.com"), NULL, SW_SHOWNORMAL);
-
Hi All, I am trying to open a web page using the following code.
ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);
It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.
Hi, This ShellExecute documentation[^] states: If the default Web browser currently runs, ShellExecute tells the instance that runs to go to your Uniform Resource Locator (URL). If it is not running, ShellExecute starts the application and then browses to your URL. Looks like the default behavior. You may need to use CreateProcess[^] instead. Best Wishes, -David Delaune
-
Hi All, I am trying to open a web page using the following code.
ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);
It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.
below code will open in new instance
ShellExecute(this->m_hWnd, _T("open"), _T("firefox.exe"), _T("www.google.com"), NULL, SW_SHOWNORMAL);
or
ShellExecute(this->m_hWnd, _T("open"), _T("iexplore.exe"), _T("www.google.com"), NULL, SW_SHOWNORMAL);
-
Hi All, I am trying to open a web page using the following code.
ShellExecute(this->m_hWnd, _T("open"), _T("www.xyz.com"), NULL, NULL, SW_SHOWNORMAL);
It works well. Consider, Default browser is Mozilla Firefox. An instance of the Mozilla Firefox is running with some tabs open in it. The above code will open a new tab (www.xyz.com) in the existing instance. Now what i want is to open my web page with new instance. Thanks & Regards, K. Sushilkumar.
K. Sushilkumar wrote:
The above code will open a new tab (www.xyz.com) in the existing instance
K. Sushilkumar wrote:
Now what i want is to open my web page with new instance.
Firefox decides (depending on the options you select in Firefox) where a URL should be opened. Your program has no way of altering that.