本文介绍了如何使用DirectShow始终如一地播放LIstbox1中的文件列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以不行......迫切需要帮助

private void menuItem6_Click(object sender,EventArgs e)

{

CleanUp() ;

listBox1.Items.Clear();

OpenFileDialog openFileDialog = new OpenFileDialog();

openFileDialog.Multiselect = true;

if(openFileDialog.ShowDialog()== System.Windows.Forms.DialogResult.OK)

{

files = openFileDialog.SafeFileNames;

paths = openFileDialog.FileNames;



for(int i = 0; i< files.Length; i ++)

listBox1.Items.Add(files [i]);

}

for(int i = 0; i< openFileDialog.FileNames.Length; i ++)

{

m_objFilterGraph = new FilgraphManager();

m_objFilterGraph.RenderFile(paths [i ]);



m_objBasicAudio = m_objFilterGraph as IBasicAudio;



//Построениеинтерфейса(разделениеаудиоивидео )

尝试

{

m_objVideoWindow = m_objFilterGraph as IVideoWindow;

m_objVideoWindow.Owner =(int)panel1。处理;

m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;

m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,

panel1.ClientRectangle.Top,

panel1.ClientRectangle.Width,

panel1.ClientRectangle.Height);

}

catch(例外)

{

m_objVideoWindow = null;

}



m_objMediaEvent = m_objFilterGraph as IMediaEvent;



m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;

m_objMediaEventEx.SetNotifyWindow((int)this.Handle,WM_GRAPHNOTIFY,0);



m_objMediaPosition = m_objFilterGraph作为IMediaPosition;



m_objMediaControl = m_objFilterGraph作为IMediaControl;



this.Text =DirectShow - [+ openFileDialog.FileName +];



m_objMediaControl.Run();

m_CurrentStatus = MediaStatus.Running;



UpdateStatusBar();

UpdateToolBar();

}

}

so not working... urgently need help
private void menuItem6_Click(object sender, EventArgs e)
{
CleanUp();
listBox1.Items.Clear();
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true;
if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
files = openFileDialog.SafeFileNames;
paths = openFileDialog.FileNames;

for (int i = 0; i < files.Length; i++)
listBox1.Items.Add(files[i]);
}
for (int i = 0; i < openFileDialog.FileNames.Length; i++)
{
m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(paths[i]);

m_objBasicAudio = m_objFilterGraph as IBasicAudio;

// Построение интерфейса(разделение аудио и видео)
try
{
m_objVideoWindow = m_objFilterGraph as IVideoWindow;
m_objVideoWindow.Owner = (int)panel1.Handle;
m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
panel1.ClientRectangle.Top,
panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height);
}
catch (Exception)
{
m_objVideoWindow = null;
}

m_objMediaEvent = m_objFilterGraph as IMediaEvent;

m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);

m_objMediaPosition = m_objFilterGraph as IMediaPosition;

m_objMediaControl = m_objFilterGraph as IMediaControl;

this.Text = "DirectShow - [" + openFileDialog.FileName + "]";

m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;

UpdateStatusBar();
UpdateToolBar();
}
}

推荐答案


这篇关于如何使用DirectShow始终如一地播放LIstbox1中的文件列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 01:10