我用WMPLib获取多媒体文件播放时间时总是0??这是为什么呢。
希望大家能帮帮忙。
WMPLib.WindowsMediaPlayer wmp = new WindowsMediaPlayer();
private void button2_Click(object sender, EventArgs e)
{
if (this.listBox1.SelectedItem != null)
{
this.textBox1.Text = this.listBox1.SelectedItem.ToString();
this.Text = "[" + this.textBox1.Text.Substring(this.textBox1.Text.LastIndexOf("\\") + 1) + "]--精品音乐";
wmp.URL = this.textBox1.Text;
//22222
//11111
this.label2.Text = wmp.currentMedia.durationString;
wmp.settings.setMode("loop", true);
wmp.controls.play();
}
else
{
this.button1.PerformClick();
}
}
希望大家能帮帮忙。
WMPLib.WindowsMediaPlayer wmp = new WindowsMediaPlayer();
private void button2_Click(object sender, EventArgs e)
{
if (this.listBox1.SelectedItem != null)
{
this.textBox1.Text = this.listBox1.SelectedItem.ToString();
this.Text = "[" + this.textBox1.Text.Substring(this.textBox1.Text.LastIndexOf("\\") + 1) + "]--精品音乐";
wmp.URL = this.textBox1.Text;
//22222
//11111
this.label2.Text = wmp.currentMedia.durationString;
wmp.settings.setMode("loop", true);
wmp.controls.play();
}
else
{
this.button1.PerformClick();
}
}
解决方案 »
- 正则表达式:"<100 or >50 or <1000" 怎么写才能提取的各个or前面的数据,我用".*or"的话会把第二个or之前的字符串全部取出的。求教!
- 十分简单的directinput问题
- C# 真的不能像VB那样实现图片直正透明的吗?
- 还是接口的问题
- 两轴线-柱图 水晶报表
- 水晶报表的问题
- 求developer.express.net.windowsforms for vs2008
- ★★★★★★★★★★★★★如何从数据库中把二进制的文件从服务器中下载到本机?
- 163、sina、sohu等大型网站,哪个生成HTML网页是如何实现的?
- 谁能给个即时通讯的源代码,有注释的!!!
- 求一个仿google搜索的智能提示代码 c# sql环境
- c#自定义控件
所以在利用的时候可以加一个timer控件:Private void Timer1_Tick(...)
{
if (AxWindowsMediaPlayer1.currentMedia.duration == 0)
MessageBox.Show('可能因为媒体文件的打开需要一定时间,这里等待媒体文件的打开');
MessageBox.Show(AxWindowsMediaPlayer1.currentMedia.duration.ToString());
}此时MessageBox便会显示文件播放长度。