0

我已经下载了 .net 示例 FindPrivateKey,为框架 4.0 编译,尝试了不同的平台(32 位、64 位、任何 CPU),但它不起作用。总是同样的错误:无法在动态链接库 comctl32.dll 中找到序号 345。我使用的是 Windows 7 Enterprise,64 位版本。此方法调用失败:matches = X509Certificate2UI.SelectFromCollection(store.Certificates, "Select certificate", "Select the certificate to find the location of associated private key file:", X509SelectionFlag.SingleSelection); 这里可能有什么问题?

亚历山大

4

1 回答 1

1

今天早上我遇到了同样的问题(无法找到序数 345 ......)......我已经在 3 台不同的 PC 上使用 Win7 64 位尝试了该应用程序;但仅在其中之一中抛出异常。我发现问题出在使用 comctl32.dll 库(与我的不同)。

您可以执行这段代码来检查您正在使用的库的版本:

foreach (ProcessModule module in System.Diagnostics.Process.GetCurrentProcess().Modules)
            if (module.ModuleName.ToLower() == "comctl32.dll")
                MessageBox.Show(module.FileVersionInfo.ToString());

然后添加一个清单并强制应用程序使用特定的库版本: [项目] -> 添加新项目 -> 应用程序清单并编辑它添加以下依赖项部分。

我希望这对你有用...

    <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>

… 
… 
…

  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
</asmv1:assembly>
于 2011-04-22T14:06:57.050 回答