如何使 Delphi 控制面板小程序成为非“旧版”?

发布于 2024-08-08 15:23:32 字数 454 浏览 1 评论 0原文

我有一个当前使用 Delphi 7 编写的 Delphi .CPL,它需要更新 HKLM 中的设置(由服务应用程序使用)并且必须支持 Vista、Win7 和 Server 2008。目前,这可以通过向 AppCompatFlags 添加 RUNASADMIN 值来完成/Layers,使用 CPL 文件作为值名称。这会导致 Windows 要求提升“旧版控制面板小程序”的权限。

我需要找到一种在 Delphi 2010 中构建 CPL 的方法,使其不显得“遗留”,并且如果可能的话,不需要注册表设置或提升。将常用的清单资源添加到引用 Common-Controls v6 和“requireAdministrator”的 DLL/CPL 中并不能解决问题:不请求提升并且 HKLM 访问失败。通过导航到 SYSWOW64 中的文件,右键单击并“以管理员身份”运行,可以使原始文件和 Delphi 2010 .CPL 正确运行(提升后)。

后来:我在论坛帖子

I have a Delphi .CPL currently written with Delphi 7 which needs to update settings in HKLM (to be used by a service application) and which must support Vista, Win7 and Server 2008. Currently this can be done by adding a RUNASADMIN value to AppCompatFlags/Layers, using the CPL file as the value name. This causes Windows to ask for elevation for a 'legacy control panel applet'.

I need to find a way to build the CPL in Delphi 2010 without it appearing to be 'legacy' and, if possible, not to require the registry setting or elevation. Adding the usual manifest resource to the DLL/CPL referencing Common-Controls v6 and "requireAdministrator" does not fix the problem: no elevation is requested and HKLM access fails. Both the original and the Delphi 2010 .CPL can be made to run correctly (after elevation) by navigating to the file in SYSWOW64, right-clicking, and running 'as Administrator'.

Later: I have found a succint explanation of why you cannot elevate a DLL in this way in a forum posting here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

调妓 2024-08-15 15:23:32

我相信你需要使用 COM 提升。有一篇精彩的博客文章似乎已被删除,但该文章背后的源代码仍然是在 VCL 组件上可用 网站(返回机器链接)。

一些附加信息可以在以下问题/答案中找到: Delphi:提示需要时进行 UAC 提升

I believe you need to use COM elevation. There was a wonderful blog posting on this which appears to have been taken down, but the source code behind the posting is still available on the VCL components website (way back machine link).

Some additional information can be found in the question/answers for: Delphi: Prompt for UAC elevation when needed

从此见与不见 2024-08-15 15:23:32

我想我已经找到了更好的答案来回答我的问题。有一种“非传统”控制面板小程序这样的动物,在 MSDN 此处。 “现在,在 Windows Vista 中,您可以通过为您的小程序创建可执行文件并注册它来将您自己的小程序添加到控制面板,而无需经历创建 .cpl 文件的麻烦。”

I think I have found a better answer to my question. There is such an animal as a 'non-legacy' control panel applet, which is described in MSDN here. "Now, in Windows Vista, you can add your own applet to Control Panel by creating an executable for your applet and registering it, instead of going through the trouble of creating a .cpl file."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文