2011-02-23 126 views
0

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

亚历山大

回答

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> 
+0

我发现你也可以使用'#pragma'预处理做到这一点。有什么不同吗? '#pragma comment(linker,“/ manifestdependency:\”type ='win32'name ='Microsoft.Windows.Common-Controls'version ='6.0.0.0'processorArchitecture ='*'publicKeyToken ='6595b64144ccf1df'language =' *'\ “”)' – Banderi 2014-11-28 21:33:14

相关问题