Alex
Alex

Reputation: 36171

How to get "Open With" programs with their full paths from the registry on Windows with C++?

I'm using Qt, and it has a really helpful QSettings class that allows to easily access the Windows registry:

QSettings s("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.html\\OpenWithList", QSettings::NativeFormat);

s.value("a").toString() returns "chrome.exe".

Chrome is not in my computer's PATH. Running chrome.exe in the terminal results in a not found error. So I can't just run it in my C++ app.

I also can't get the icon for it, as I need full path.

So how do I find this full path? (In case of Chrome it's C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe)

Upvotes: 0

Views: 559

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490728

Don't mess with the registry directly -- FindExecutable is designed to produce exactly what you want/need.

Upvotes: 1

Related Questions