VS 调试shell32.dll 程序

用C#做一个音乐播放器的程序,其中用到一个ShellClass类,包含在shell32.dll中,使用的是win10,运行OK,

将该程序放在windows 7 中运行时,出现以下错误:

Unable to cast COM object of type 'Shell32.ShellClass' to interface type 'Shell32.IShellDispatch5'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866738B9-6CF2-4DE8-8767-F794EBE74F4E}' failed due to the following error: 不支持此接口 (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

然后将该dll替换成一个1.2.107的版本,完美运行。并且向上兼容。

 

替换过程中的问题:

VS无法嵌入互操作类型“Shell32.ShellClass",解决方案:

VS 调试shell32.dll 程序

替换完成后,出现以下问题:

出现问题未能加载文件或程序集“Interop.Shell32”或它的某一个依赖项。试图加载格式不正确的程序。

解决方法:重新生成项目解决方案

 

 

下载地址:https://download.****.net/download/shizhibuyi1234/12634399