问题描述
我有一个名为VideoForm的表单,该表单具有一个称为Player的Windows Media Player.
I have a form called VideoForm which has a Windows Media Player called player.
public AxWMPLib.AxWindowsMediaPlayer player;
当我打开VideoFrame.cs [Design]时,出现两个错误:
When I open VideoFrame.cs [Design] I get two errors:
变量"player"未声明或从未分配.
The variable 'player' is either undeclared or was never assigned.
如果我在解决方案中创建一个新表单并尝试向其中添加Windows Media Player,则会出现此错误:
If I create a new form in my solution and try to add a Windows Media Player to it, I get this error:
(下面列出的大量类型基本上等于工具箱需要进行控制的东西")
我已经尝试:重新启动Visual Studio,重新启动计算机,删除并重新导入库,切换到32,进行构建,然后再切换回64,然后再次进行构建,并手动找到库文件在我的机器上.
I have tried: restarting Visual Studio, restarting my computer, deleting and re-importing the libraries, switching to 32, building, then switching back to 64 and building again, and manually finding the lib files on my machine.
但是这是一个很奇怪的部分-,如果我关闭此解决方案,再打开另一个,添加Windows Media Player,编译为64位,然后关闭并重新打开原始解决方案,我不会收到错误!
但是,当我尝试上述"hack"时,我确实得到以下两个错误:
But here's the weird part- if I close this solution, open another, add a Windows Media Player, compile to 64 bit, then close and reopen the original solution I don't get the errors!
I do however get the following two errors when I attempt the above "hack":
and
我认为我遇到了内存泄漏,但是很茫然,并且在运行时无论在线程"或"GPU线程"窗口中什么都看不到.
I think I am getting a memory leak but am at a loss, and I see nothing at runtime in either Threads or GPU Threads windows.
我不认为是导致此问题的代码,但是,如果您想查看代码注释,则将添加相关部分.
I do not believe it is my code that is causing this, however if you want to see the code comment and I will add relevant parts.
推荐答案
我找到了解决此问题的方法:
I found solution to this problem:
{
Warning 1 Processing COM reference "WMPLib" from path "C:\Windows\system32\wmp.dll". Type library importer encountered a property getter 'sessionPlaylistCount' on type 'WMPLib.IWMPNowPlayingHelperDispatch' without a valid return type. The importer will attempt to import this property as a method instead.
Warning 2 Processing COM reference "WMPLib" from path "C:\Windows\system32\wmp.dll". At least one of the arguments for 'IWMPGraphEventHandler.NotifyAcquireCredentials' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.
}
我必须编辑我的话!如果收到这些错误这并不意味着您的应用程序将无法运行但是,如果您编译程序,则不会在旧版Windows上运行安装文件您可以设置以下内容:将您的程序框架设置为4客户端版本并将您的程序平台设置为X86并在Framework 4客户端上创建安装程序
i must edit my word !If you receive these errorThis does not mean that your application will not runBut if you compile your program does not run setup file on Windows oldYou can set the following:set your program framework to 4 client versionand set your platform of program to X86and creat your installer on framework 4 client
这篇关于Windows Media Player设计器视图引发CPU和lib错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!