【发布时间】:2009-10-20 07:34:23
【问题描述】:
我从以下位置下载了适用于 Microsoft® .NET Framework 的 Windows® API 代码包 http://code.msdn.microsoft.com/WindowsAPICodePack/Release/ProjectReleases.aspx?ReleaseId=3077
错误
在 VS 2008 上测试解决方案时,出现一行错误
IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass();
knownFolderManager.GetFolderIds(out folders, out count);
详情如下,
System.Runtime.InteropServices.COMException was unhandled
Message="Retrieving the COM class factory for component with CLSID {4DF0C730-DF9D-4AE3-9153-AA6B82E9795A} failed due to the following error: 80040154."
Source="Microsoft.WindowsAPICodePack.Shell"
ErrorCode=-2147221164
StackTrace:
at Microsoft.WindowsAPICodePack.Shell.KnownFolders.GetAllFolders() in D:\WindowsAPICodePack\WindowsAPICodePack\Shell\KnownFolders\KnownFolders.cs:line 43
at Microsoft.WindowsAPICodePack.Shell.KnownFolders.get_All() in D:\WindowsAPICodePack\WindowsAPICodePack\Shell\KnownFolders\KnownFolders.cs:line 29
at Microsoft.WindowsAPICodePack.Samples.ExplorerBrowserTestForm..ctor() in D:\WindowsAPICodePack\Samples\ExplorerBrowser\CS\WinForms\ExplorerBrowserTestForm.cs:line 27
at Microsoft.WindowsAPICodePack.Samples.Program.Main() in D:\WindowsAPICodePack\Samples\ExplorerBrowser\CS\WinForms\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
问题
请帮助解决此错误。
【问题讨论】:
-
此错误代码表示您请求的对象未在系统上注册。 IKnownFolderManager 从 Vista 开始出现。你的 Windows 版本是多少?
-
非常感谢。我有 Windows XP。
-
其实是想看看能不能用windows api和c#开发一个类似windows explorer的应用[with treeview,listview]。