3

可能重复:
免注册 COM/DLL?

我支持一个使用大量用 Delphi 编写的 ActiveX 控件的应用程序,主要用于将应用程序聚合在一起。这些当前必须注册,这可以,但不整洁。有没有人为用 Delphi 编写的 DLL(或任何其他非 .NET 解决方案)获得并排(或 reg-free-com)?

4

1 回答 1

2

您可以使用 Delphi 并排注册免费 COM,我相信您需要编写这样的清单文件,这是一个不精确且不完整的示例,但是如果您遵循各地可用的信息,并替换您自己的类和接口,我相信这显示了您需要执行的最少条目:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="14.0.3615.26342" processorArchitecture="*" name="MyApp" type="win32"></assemblyIdentity>
  <description>my app description</description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <file name="MyComObject.DLL" hashalg="SHA1">
    <comClass clsid="{AA67839B-8AF0-4651-BDEE-96F01E44A682}" tlbid="{2E23AF44-33A0-48AD-88A9-948B004E0982}" description="MyClass"></comClass>
    <typelib tlbid="{EEEEEEE4-33A0-48AD-88A9-948B004E0982}" version="1.0" helpdir="" flags="FLAGS"></typelib>
  </file>
  <comInterfaceExternalProxyStub name="IMyThing" iid="{AAAAAAAA-4584-4AEE-9FA0-667460953082}" tlbid="{2E23AF44-33A0-48AD-88A9-948B004E0982}" proxyStubClsid32="{AAAAAAAA-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
</assembly>

您可以在这里找到更多帮助:

http://www.mazecomputer.com/sxs/help/inside2.htm

至于在 Delphi 中使用清单,您必须将其包含在 RC 文件中,然后将该 RC 文件链接到您的 EXE,并且不要选中项目选项(Delphi 2007 或更高版本)中的“启用 Windows 主题”复选框,因为将覆盖您尝试在此处链接的清单。上面引用“Microsoft.Windows.Common-Controls”的部分是您让您的 Delphi/VCL 应用程序主题感知的方式,所以如果您不希望这样,请去掉整个 XML 依赖项部分。

于 2011-03-09T20:59:35.867 回答