1

The following file test.cc is to launch Microsoft Edge with specific URL:

#include <Windows.h>

int main()
{
    SHELLEXECUTEINFOW sei = { sizeof sei };
    sei.lpVerb = L"open";
    sei.lpFile = L"microsoft-edge:http://www.stackoverflow.com";
    ShellExecuteExW(&sei);
}

Compile with:

cl test.cc /link shell32.lib

It works in Windows 10 (Edge opened to specific URL), but in Windows Server 2016 this program pops up an error window:

Title: microsoft-edge:http://www.stackoverflow.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 checked "Default Programs" in control panel and already chose "Set this program as default" in Microsoft Edge page.

Lee
  • 535
  • 5
  • 19
  • Do you have another browser installed _and_ set as default? If not, you should simply drop the reference to Edge in the `lpFile` param. – enhzflep Nov 05 '15 at 03:44
  • The OS also comes with IE and I installed Firefox later. These two are not set as default browser. I tried removing "microsoft-edge:" from lpFile and the same error window will pop out except the title changed from "microsoft-edge:http://www.stackoverflow.com" to "http://www.stackoverflow.com". Has it worked on your Windows Server 2016? – Lee Nov 05 '15 at 19:16
  • Bugger! No, sorry I dont have 2k16 and was presumptuous enough to assume it would do the trick. Perhaps the changed functionality is a security 'feature'. – enhzflep Nov 05 '15 at 23:03

0 Answers0