Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Friday, November 6, 2015 12:05 AM
I'm trying to open a URL with the default browser in C++. The following code works in Windows 10 even when default browser is Edge.
#include <Windows.h>
int main()
{
SHELLEXECUTEINFOW sei = { sizeof sei };
sei.lpVerb = L"open";
sei.lpFile = L"microsoft-edge:http://www.microsoft.com";
ShellExecuteExW(&sei);
}
However, it will fail in Windows Server 2016 when default browser is Edge and pops out an error dialog:
Title: microsoft-edge:http://www.
microsoft.com
Content: This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.
I have checked the default program settings and confirmed Edge is the default browser. If changing default browser to others say Firefox or IE then everything is OK.
Removing "microsoft-edge:" from lpFile does not help.
Wednesday, November 11, 2015 2:43 AM ✅Answered
Hi churiver,
Please refer to this document to check whether there’s some issue in your code. https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
This thread show how to “Use ShellExecute to launch the default Web browser”, you could refer to it.
https://support.microsoft.com/en-us/kb/224816
If these could not solve your problem, I suggest that you could contact our paid phone support at http://support.microsoft.com . You will get 1:1 support on that.
Best Regards,
Xavier Eoro
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Tuesday, December 29, 2015 2:34 PM
This is not an answer. Code
::ShellExecute( NULL, NULL, sURL, NULL, NULL, SW_SHOWNORMAL );
worked fine in all previous versions of Windows, it fail in Windows 2016 PT3 with error 5, SE_ERR_ACCESSDENIED
Your link provide sample code
LONG r = ShellExecute(NULL, "open", "http://www.microsoft.com", NULL, NULL, SW_SHOWNORMAL);
It fail with error 31 - SE_ERR_NOASSOC
Thursday, April 6, 2017 12:34 PM
The Third parameter of ShelLExecute API is lpFile which name the application you want to launch and <g class="gr_ gr_30 gr-alert gr_gramm gr_run_anim Grammar only-ins replaceWithoutSep" data-gr-id="30" id="30">fourth</g> parameter is the parameter to that application.
if you add "iExplore.exe" as the third parameter and fourth parameter as "http://www.microsoft.com" it should work. see below code, it works for me in windows server 2016
LONG r = ShellExecute(NULL, "open", "iexplore.exe","http://www.microsoft.com", NULL, SW_SHOWNORMAL);
-Anurag