c# – Reg-Free COM“Microsoft.Windows.ActCtx”是否适用于脚本
我已成功使用清单文件使用C和C#进行Reg-Free COM工作,即早期绑定.我现在正试图使用??后期绑定工作.经过大量的网络搜索,我发现的技术似乎是使用“Microsoft.
Windows.ActCtx”.
我用来测试这个的一个例子是MS在http://msdn.microsoft.com/en-us/library/ms973913.aspx发现的“基于COM的组件的免注册激活”,以生成SideBySide示例.然后我尝试使用脚本语言;然而,VBScript和Python都以相同的方式失败(也尝试过VBA). VBScript示例如下: Set actctx = CreateObject("Microsoft.Windows.ActCtx") actctx.manifest = "C:testclient.exe.manifest" Set SBSObj = actctx.CreateObject("SideBySide.SideBySideClass") wscript.echo SBSObj.Version 使用类似SysInternals的“Process Monitor”,您可以看到运行以下命令(Windows 7 x64): C:WindowsSysWOW64cscript.exe //Nologo C:testVBRegFreeTest.vbs 似乎通过加载清单工作,并尝试开始寻找等效的注册表调用,但无法找到它们.所以看起来部分有效.我还将wScript.exe复制到本地目录,以排除运行应用程序和清单文件的目录问题. 我已阅读Microsoft.Windows.ActCtx on Windows Xp并在清单中包含“prodID”,但仍然失败.清单文件可以正确使用C和C#示例. 我不禁感到“Microsoft.Windows.ActCtx”存在问题.关于此的文件非常有限.任何使用Python或VBScript使用清单文件的帮助都将非常感激.我很想知道是否有人有“Microsoft.Windows.ActCtx”工作. 解决方法
>您的EXE必须具有描述COM服务器名称和版本的依赖关系部分的清单,例如: SideBySide.dll.
>如果您的EXE具有内部清单:如果存在内部清单,则Windows 7将不会读取外部清单(Windows XP首先查找外部清单). >在Windows 7上,必须更改EXE的内部清单并依赖于COM服务器,或者必须从EXE中删除内部清单.可以使用Visual Studio中的mt.exe. > SideBySide.dll和SideBySide.dll.manifest必须与EXE位于同一文件夹中. > SideBySide.dll.manifest必须包含comClass部分中COM服务器的progID. 使用DLL的VBS代码示例:Registration-Free Activation of COM Components: A Walkthrough Dim o Set o = CreateObject("Microsoft.Windows.ActCtx") //in example here is a manifest reference: o.manifest = "SideBySide.X.manifest" //but it does not function by me. By me a dependency is described in manifest of EXE. Dim obj Set obj = o.CreateObject("SideBySideLib") Call MsgBox(obj.Version()) Set obj = Nothing Set o = Nothing (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |