0

I'm doing the following in my app's installer (note that the installer for this project is just a Windows executable (setup.exe) and not an MSI.)

First I needed to check if there're file associations for .htm and .html file types. I did so already. And then if there's no association I needed to add them to be opened by a web browser.

To make a lesser of an impact on a user's system, I thought to go with the user's default web browser. The question is how to find its path?

So I was doing this:

//Get default web browser path
WCHAR wbuffPath[MAX_PATH] = {0};
DWORD dwszBuffPath = MAX_PATH;
::AssocQueryStringW(0, ASSOCSTR_EXECUTABLE, L"http", L"open", wbuffPath, &dwszBuffPath);

which seems to work, except when I run it on Windows 10 I get this path (when default is the Edge browser):

C:\WINDOWS\system32\LaunchWinApp.exe

So how do I get the reset of the parameters to start it?

1 Answer 1

1

Try using ASSOCSTR_COMMAND instead of ASSOCSTR_EXECUTABLE. By using ASSOCSTR_EXECUTABLE, you are asking for just the executable by itself, which is exactly what you are getting back. ASSOCSTR_COMMAND should give you the whole command line for the executable.

Sign up to request clarification or add additional context in comments.

1 Comment

Hah. Interesting. If I do that, it simply gives me "C:\WINDOWS\system32\LaunchWinApp.exe" "%1". That's how they do it in Windows 10. Pretty neat! Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.