简体   繁体   English

在vb.net应用程序中,AxWindowsMediaPlayer在客户端计算机上不起作用

[英]In vb.net application AxWindowsMediaPlayer does not work on client machines

I have added COM control AxWindowsMediaPlayer to form in vb.net. 我已经在vb.net中添加了COM控件AxWindowsMediaPlayer。

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. abase.mp4文件保存在exe所在的目录中。 Every thing runs fine on dev m/c but on client machine application is not lauached. 一切都可以在dev m / c上正常运行,但是在客户端计算机上的应用程序却无法正常运行。

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. 将Interop.WMPLib.dll和Interop.WMPLib.dll复制到exe文件目录时,至少启动了应用程序,但该文件不会自动播放,甚至在按下播放按钮时也不会播放。

Is some dll registration required to make it work? 是否需要一些dll注册才能使其正常工作? or some references needed in project? 或项目中需要一些参考? or some changes on user machine? 或用户计算机上的某些更改?

Copying the DLLs is required, it cannot work otherwise. 需要复制DLL,否则它将无法正常工作。 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"). 您只提供文件的相对位置,而不是完整路径(例如“ 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. 在您的计算机上,此文件需要存储在项目目录的bin \\ Debug文件夹中才能正常工作。 Another machine you deploy your program to isn't going to have a bin\\Debug (or Release) folder. 您将程序部署到的另一台计算机将没有bin \\ Debug(或Release)文件夹。 It still needs to be present in the same directory as the EXE. 它仍然需要与EXE位于同一目录中。 Maybe you forgot to copy the .mp4 file? 也许您忘了复制.mp4文件?

Clearly you'll want to provide the user with a way to select the file. 显然,您需要为用户提供选择文件的方式。 Use OpenFileDialog. 使用OpenFileDialog。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM