在 vb.net 应用程序中 AxWindowsMediaPlayer 无法在客户端计算机上运行
我已将 COM 控件 AxWindowsMediaPlayer 添加到 vb.net 中的窗体中。
只需将以下代码
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WMPlayerVideo.URL = "abase.mp4"
End Sub
End Class
abase.mp4 文件保存在 exe 所在的目录中。一切在开发主机上运行良好,但在客户端计算机上应用程序未启动。
当Interop.WMPLib.dll和Interop.WMPLib.dll被复制到exe文件目录时,至少会启动应用程序,但文件不会自动播放,即使按下播放按钮也不会播放。
是否需要注册一些 dll 才能使其工作?或者项目中需要的一些参考资料? 或者用户机器上的一些变化?
I have added COM control AxWindowsMediaPlayer to form in vb.net.
and just have following code
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WMPlayerVideo.URL = "abase.mp4"
End Sub
End Class
abase.mp4 file is kept in directory where exe is there. Every thing runs fine on dev m/c but on client machine application is not lauached.
When Interop.WMPLib.dll and Interop.WMPLib.dll are copied to the exe file directory then application is lauched at least but file is not played automatically and even on pressing play button its not played.
Is some dll registration required to make it work? or some references needed in project?
or some changes on user machine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要复制 DLL,否则无法工作。这留下了文件的位置。您仅给出文件的相对位置,而不是完整路径(如“c:\mumble\foo.mp4”)。在您的计算机上,该文件需要存储在项目目录的 bin\Debug 文件夹中才能正常工作。您部署程序的另一台计算机不会有 bin\Debug(或 Release)文件夹。它仍然需要与 EXE 位于同一目录中。也许您忘记复制 .mp4 文件?
显然,您需要为用户提供一种选择文件的方法。使用打开文件对话框。
Copying the DLLs is required, it cannot work otherwise. Which leaves the location of the file. You are only giving the relative location of the file, not the full path (like "c:\mumble\foo.mp4"). On your machine, this file needs to be stored in the bin\Debug folder of your project directory to make it work. Another machine you deploy your program to isn't going to have a bin\Debug (or Release) folder. It still needs to be present in the same directory as the EXE. Maybe you forgot to copy the .mp4 file?
Clearly you'll want to provide the user with a way to select the file. Use OpenFileDialog.