是否可以使用免注册COM与HTA应用程序? [英] Is it possible to use registration-free COM with HTA applications?

查看:257
本文介绍了是否可以使用免注册COM与HTA应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于HTA应用程序托管在MSHTA.exe中,如何提供清单?

Since HTA applications are hosted within MSHTA.exe how does one provide a manifest? Plus I assume providing a MSHTA.exe.manifest could potentially break other HTA apps?

推荐答案

在Vista +上,MSHTA.exe有一个可以破坏其他HTA应用程序的MSHTA.exe.manifest。

On Vista+, MSHTA.exe has an embedded manifest, which takes priority over external manifests, so your suggestion is not an option.

在XP / 2003上,是的,你的建议会工作,虽然这将是坏的形式,正如在System32中删除文件修改系统二进制文件的行为(特别是要确保您放入清单中的任何注册都是您唯一关心的对象)。

On XP/2003, yes, your suggestion would work, although it would be bad form, as is dropping files in System32 to modify the behavior of a system binary (especially make sure that any registration you put in the manifest are objects you are the only one to care about).

在Win2003及以上版本上可用的正确解决方案是使用 Microsoft.Windows.ActCtx 对象,以给定明确的清单引用来实例化您的对象。

The proper solution, available on Win2003 and above, is to use the Microsoft.Windows.ActCtx object to instantiate your object given an explicit manifest reference.

例如:

var actCtx = WScript.CreateObject("Microsoft.Windows.ActCtx");
actCtx.Manifest = "myregfree.manifest";
var obj =  actCtx.CreateObject("MyObj");   

也许,如果这必须在XP上工作,你可以采取的路径是两者的组合解决方案。

Perhaps, if this must work on XP as well, a path you may take is a combination of both solutions.

这篇关于是否可以使用免注册COM与HTA应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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