我目前正在使用 ShellExecute“打开”在用户浏览器中打开一个 URL,但在 Win7 和 Vista 中遇到了一些麻烦,因为该程序作为服务运行。
当 ShellExecute 打开浏览器时,它似乎读取的是“本地管理员”配置文件而不是用户的配置文件。例如,如果键盘上的用户将 Firefox 作为他的默认浏览器,它可能会打开 IE(这是管理员的默认设置)。
我知道“runas”动词可以用来提升,但你如何反其道而行之?是否可以通过服务在标准用户桌面上的默认浏览器中打开 URL?
I can find out where Firefox is installed as follows; query this key to get the current version:
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox
CurrentVersion
Run Code Online (Sandbox Code Playgroud)
... then query this key to get the installed path (where "nnn" is the version number obtained above):
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\nnn\Main
Install Directory
Run Code Online (Sandbox Code Playgroud)
But I can't work out how to find where IE is installed. What key or keys will work on Windows XP, Windows Server 2003, and later?