如何从带有C++的Windows上的注册表中获取具有完整路径的"Open With"程序?

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

本文关键字:路径 Open 程序 With C++ Windows 注册表 获取      更新时间:2023-10-16

我正在使用Qt,它有一个非常有用的QSettings类,可以轻松访问Windows注册表:

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

s.value("a").toString()返回"chrome.exe" .

Chrome 不在我计算机的路径中。在终端中运行chrome.exe会导致"未找到"错误。所以我不能只在我的C++应用程序中运行它。

我也无法获得它的图标,因为我需要完整路径。

那么如何找到这个完整的路径呢?(如果是铬,它是C:UsersAdministratorAppDataLocalGoogleChromeApplicationchrome.exe

不要直接弄乱注册表 - FindExecutable旨在产生您想要/需要的东西。