在Windows窗体中播放视频文件的问题 [英] problem playing video file in windows form
问题描述
大家好吧
hmmmmm ...
对我有点沮丧...
有c#express 2010
直接安装sdk
目标.net 3.5
想要播放视频文件
添加参考如下
右键单击引用...添加引用..浏览..c:\关于...... microsoft.net .... directx托管代码... mcrosoft.directx.audiovideoplayback.dll
代码如下
hi all
hmmmmm...
bit frustrating for me...
have c# express 2010
direct sdk installed
targetting .net 3.5
wnt to pla video file
added reference as follows
right click on reference...add reference..browse..c:\windows......microsoft.net....directx managed code...mcrosoft.directx.audiovideoplayback.dll
code is as follows
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.AudioVideoPlayback;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int PanelWidth = videopanel.Width;
int PanelHeight = videopanel.Height;
Video myvideo = new Video("c:\\my_xvid.avi");
myvideo.Owner = videopanel;
videopanel.Width = PanelWidth;
videopanel.Height = PanelHeight;
myvideo.Play();
myvideo.Pause();
}
}
}
获得如下异常
有关调用
实时(JIT)调试而不是此对话框的详细信息,请参阅此消息的结尾。
* *************异常文本**************
应用程序出错。
-2147467262(E_NOINTERFACE)
at Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName,Boolean autoRun)
at Microsoft.DirectX.AudioVideoPlayback.Video..ctor(字符串fileName)
在WindowsFormsApplication1.Form1.button1_Click(Object sender,EventArgs e)中的e:\ project:\\ vieo1 \vieo1 \Form1.cs:第27行
$ b $。在System.Windows.Forms.Control.OnClick(EventArgs e)
在System.Windows.Forms.Button.OnClick(EventArgs e)
在System.Windows .Forms.Button.OnMouseUp(MouseEventArgs mevent)
在System.Windows.Forms.Control.WmMouseUp(消息& m,MouseButtons按钮,Int32点击)
在System.Windows.Forms.Control.WndProc(消息& m)
在System.Windows.Forms.ButtonBase.WndProc(Message& m)
在System.Windows.Forms.Button.WndProc(Message& m)
(消息& m)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)
**************已加载的装配**************
mscorlib
汇编版本:2.0.0.0
Win32版本:2.0.50727.3053(netfxsp.050727-3000)
CodeBase:file:/// C:/WINDOWS/Microsoft.NET /Framework/v2.0.50727/mscorlib.dll
-------------------------------- --------
vieo1
汇编版本:1.0.0.0
Win32版本:1.0.0.0
CodeBase:file:/// e:/projects/vieo1/vieo1/bin/Release/vieo1.exe
---------------- - ----------------------
System.Windows.Forms
汇编版本:2.0.0.0
Win32版本:2.0.50727.3053(netfxsp.050727-3000)
CodeBase:file:/// C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/ 2.0.0.0__b77a5c561934e089 / System.Windows.Forms.dll
------------------------------ ----------
系统
汇编版本:2.0.0.0
Win32版本:2.0.50727.3053(netfxsp。 050727-3000)
CodeBase:file:/// C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
---- ------------------------------------
System.Drawing >
汇编版本:2.0.0.0
Win32版本:2.0.50727.3053(netfxsp.050727-3000)
CodeBase:file:/// C:/ WINDOWS / assembly / GAC_MSIL / System.Drawing / 2.0.0.0__b03f5f7f11d50a3a / System.Drawing.dll
---------------------- ------------------
Microsoft.DirectX.AudioVideoPlayback
汇编版本:1.0.2902.0
Win32版本:5.04.00.2904
CodeBase:file:/// C:/WINDOWS/assembly/GAC/Microsoft.DirectX.AudioVideoPlayback/ 1.0.2902.0__31bf3856ad364e35 /Microsoft.DirectX.AudioVideoPlayback.dll
------------------------------ ----------
Microsoft.DirectX
汇编版本:1.0.2902.0
Win32版本:5.04.00.2904
CodeBase:file:/// C:/WINDOWS/assembly/GAC/Microsoft.DirectX/1.0.2902.0__31bf3856ad364e35/Microsoft.DirectX.dll
----- -----------------------------------
************** JIT调试**************
启用实时(JIT)调试,此
应用程序或计算机(machine.config)的.config文件必须在system.windows.forms部分设置
jitDebugging值。
应用程序也必须通过调试编译
启用。
例如:
< b r />
< configuration>
< system.windows.forms jitdebugging =true>
启用JIT调试后,任何未处理的异常
将被发送到计算机上注册的JIT调试器
而不是由此对话框处理框。
getting exception as follows
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
Error in the application.
-2147467262 (E_NOINTERFACE)
at Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
at Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName)
at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in e:\projects\vieo1\vieo1\Form1.cs:line 27
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
vieo1
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///e:/projects/vieo1/vieo1/bin/Release/vieo1.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.DirectX.AudioVideoPlayback
Assembly Version: 1.0.2902.0
Win32 Version: 5.04.00.2904
CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.DirectX.AudioVideoPlayback/1.0.2902.0__31bf3856ad364e35/Microsoft.DirectX.AudioVideoPlayback.dll
----------------------------------------
Microsoft.DirectX
Assembly Version: 1.0.2902.0
Win32 Version: 5.04.00.2904
CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.DirectX/1.0.2902.0__31bf3856ad364e35/Microsoft.DirectX.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
推荐答案
http://stackoverflow.com/questions/17461670/c-sharp-play-video-without-using-madie-player-windows-form-application [ ^ ]
请参阅此链接
如何在C#windows窗体中播放视频或.flv应用程序离子? [ ^ ]
播放音频和视频文件 - 使用C-Sharp / [ ^ ]
希望它能帮到你..
Refer this links
How to play video or .flv in C# windows form application ?[^]
playing-audio-and-video-files-using-C-Sharp/[^]
Hope it will help you..
这篇关于在Windows窗体中播放视频文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!