如果从 Windows 8 RTM 中设置的提升进程和非默认浏览器运行 ShellExecute 将失败 [英] ShellExecute fails if run from elevated process and non-default browser set in Windows 8 RTM

查看:14
本文介绍了如果从 Windows 8 RTM 中设置的提升进程和非默认浏览器运行 ShellExecute 将失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 8 RTM(Chrome、Firefox)中设置非默认浏览器并尝试运行如下代码:

Set non-default browser in Windows 8 RTM (Chrome, Firefox) and try to run code like this:

ShellExecute(NULL, "open", "http://stackoverflow.com", NULL, NULL, SW_SHOWNORMAL);

没关系.但随后将清单更改为需要管理权限或仅以管理员身份运行".

It's ok. But then change manifest to require Administrative priveleges or just "run as administrator".

代码不起作用.

好的,然后尝试使用以管理员身份运行"运行任何应用程序.

Ok, then try to run any application using "run as administrator".

您将看到相同的结果,链接无效.

You will see the same result, links are not working.

将默认浏览器改回 IE -> 一切正常.

Change default browser back to IE -> all works fine.

在 Windows 8 以前的版本中没有这样的行为.

In Windows 8 previous builds there is no such behavour.

发生了什么事?

PS.微软似乎在他们自己的软件中遇到了同样的问题:)Windows 8 上的 Visual Studio 2012 Web 发布RTM 浏览器启动失败

PS. It seems Microsoft experienced the same problems in their own software :) Visual Studio 2012 Web Publish on Windows 8 RTM Fails Browser Launch

推荐答案

直到今天,我一直在 Chrome 上看到同样的行为.花了一些时间试图弄清楚发生了什么,并且在很长一段时间内都无法让 Chrome 在提升的权限下提出 ShellExecute().提升权限(即 UAC 对话框或以管理员身份运行)或什至完全关闭 UAC 时失败.

I've been seeing the same behavior with Chrome until today. Spent some time trying to figure out what was going on and couldn't for the longest time make Chrome come up with ShellExecute() under elevated rights either. Failed for elevated rights (ie. UAC dialog, or Run As Administrator) or even when turning off UAC altogether.

我最终卸载并重新安装了 Chrome 并且实际上修复了它.

I ended up uninstalling and re-installing Chrome and that actually fixed it.

也看到了其他浏览器的行为,但是在使用 FireFox 进行了几次尝试后,我进入了 FireFox 的设置默认程序"设置,并明确(即在 Windows 中)设置了 .htm 文件和 HTTP 协议的关联.这也很有效.

Also saw the behavior with other browsers, however after a few tries with FireFox I went into the Set Default Programs settings from FireFox and EXPLICITLY (ie. in Windows) set the associations for .htm file and the HTTP protocol. That worked as well.

所以看起来这是某种注册问题,而不是 Windows 中的实际问题.我要尝试的第一件事是在 Windows 中显式设置关联(而不是在浏览器中设置默认浏览器).如果失败,请尝试重新安装浏览器...

So it looks like this is some sort of registration issue, rather than an actual problem in Windows. First thing I would try is to explicitly set the associations in Windows (rather than Set Default Browser in the browser). If that fails try reinstalling the browser...

这篇关于如果从 Windows 8 RTM 中设置的提升进程和非默认浏览器运行 ShellExecute 将失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆