用QuartzTypeLib.dll播放视频
2013-01-30 16:05
316 查看
播放选定的文件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace MediaApp { public partial class Form1 : Form { private const int WS_CHILD = 0x40000000; private const int WS_CLIPCHILDREN = 0x2000000; private QuartzTypeLib.IMediaControl MyControl = null; private QuartzTypeLib.IVideoWindow MyWindow = null; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog MyDialog = new OpenFileDialog(); MyDialog.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*"; if (MyDialog.ShowDialog() == DialogResult.OK) { try { QuartzTypeLib.FilgraphManager MyManager = new QuartzTypeLib.FilgraphManager(); if (MyControl != null) MyControl.Stop();//如果已经播放过,则先停止 MyManager.RenderFile(MyDialog.FileName);//加载音频、视频文件 MyWindow = (QuartzTypeLib.IVideoWindow)MyManager; try//音频文件不需要用pictureBox1,所以会报错 { MyWindow.Owner = (int)pictureBox1.Handle; MyWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN; MyWindow.SetWindowPosition(pictureBox1.ClientRectangle.Left,pictureBox1.ClientRectangle.Top,pictureBox1.ClientRectangle.Width,pictureBox1.ClientRectangle.Height); } catch { } MyControl = (QuartzTypeLib.IMediaControl)MyManager; MyControl.Run(); } catch(Exception Mye) { MessageBox.Show(this,Mye.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Error); } } } } } 播放指定的文件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { private const int WS_CHILD = 0x40000000; private const int WS_CLIPCHILDREN = 0x2000000; private QuartzTypeLib.IMediaControl MyControl = null; private QuartzTypeLib.IVideoWindow MyWindow = null; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { try { QuartzTypeLib.FilgraphManager MyManager = new QuartzTypeLib.FilgraphManager(); if (MyControl != null) MyControl.Stop();//如果已经播放过,则先停止 MyManager.RenderFile("Ending.mpg");//加载音频、视频文件 MyWindow = (QuartzTypeLib.IVideoWindow)MyManager; try//音频文件不需要用pictureBox1,所以会报错 { MyWindow.Owner = (int)pictureBox1.Handle; MyWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN; MyWindow.SetWindowPosition(pictureBox1.ClientRectangle.Left, pictureBox1.ClientRectangle.Top, pictureBox1.ClientRectangle.Width, pictureBox1.ClientRectangle.Height); } catch { } MyControl = (QuartzTypeLib.IMediaControl)MyManager; MyControl.Run(); } catch (Exception Mye) { MessageBox.Show(this, Mye.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
相关文章推荐
- C#编写媒体播放器--Microsoft的Directx提供的DirectShow组件,该组件的程序集QuartzTypeLib.dll.
- QuartzTypeLib.dll 文件
- C# 播放器 QuartzTypeLib.dll 文件
- Media DLL with QuartzTypeLib
- QuartzTypeLib.dll 文件
- QuartzTypeLib.dll 文件
- QuartzTypeLib网络电视开发
- VB中利用QUARTZ.DLL播放视音频的实现
- xvidcore.dll not found视频播放问题
- coredll.lib(COREDLL.dll) : fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'
- coredll.lib(COREDLL.dll) : fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'
- SysLetvPlayerLib无法播放本地视频
- 视频播放与轮廓
- Unity3D基础学习 利用NGUI的Texture播放视频
- webview全屏播放html5的视频
- cygwin下dll和lib的生成方法
- android 播放视频时切换全屏隐藏状态栏
- 沪江日语百度云视频 0-n1百度云网盘视频的swf需要特定的播放器才能播放
- 在播放Flv视频时添加标题或边框(1)
- asp.net实现播放视频