gpt4 book ai didi

C# Windows 媒体播放器 AxHost 错误 : Failed to create compopnent 'AxHost'

转载 作者:可可西里 更新时间:2023-11-01 11:25:59 25 4
gpt4 key购买 nike

我正在尝试将 Windows Media Player 对象添加到我的 Windows 窗体,但弹出错误消息:

Failed to create compopnent 'AxHost'. The error message follows:
'System.Reflection.ReflectionTypeLoadException: Unable to load
one or more of the requested types. Retrieve the LoaderExceptions
property for more information.
at
System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.
CreateComponentsCore(IDesignerHost host)
at
System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost
host, IDictionary defaultValues)
at
System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost
host, IDictionary defaultValues)
at
System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem
tool, Control parent, int32 x, int32 width, int32
height, Boolean hasLocation, Boolean hasSize,
ToolboxSnapDragDropEventArgs e)'

但是,如果我要创建一个新项目并添加 Windows Media Player,它会工作得很好。

我尝试了一些在线解决方案,例如在打开新项目(With Windows Media Player)时添加 Windows Media Player,将现有表单添加到项目等,但无济于事。

有没有我做错了什么?

最佳答案

不确定您是否仍在为此寻找解决方案,但也许这会对其他人有所帮助。我在尝试嵌入不同的 COM 对象时遇到了同样的问题。

在用头撞墙几个小时后,我意识到在项目 Properties -> Build -> Platform Target 中设置为 x64(因为几个月前我正在玩一些东西),而且很多这些旧的 COM 程序集针对 32 位系统。无论如何,将我的平台目标切换为“任何 CPU”解决了这个问题。

尼克

关于C# Windows 媒体播放器 AxHost 错误 : Failed to create compopnent 'AxHost' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36275096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com