| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 23415 人关注过本帖, 7 人收藏
标题:[开源]用Windows Media Player控件播放音乐图文教程(MP3,WAV,WMV)!(原 ...
只看楼主 加入收藏
达文西
Rank: 1
等 级:新手上路
威 望:1
帖 子:117
专家分:0
注 册:2007-8-4
收藏
得分:0 

如果代码不填 在那个里面填能播放马?
还有我加个进度条但是 进度条代码我不会添加阿

2007-09-06 16:18
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 

没试过,理论上应该是可以的。如果要加进度条的话那就在我昨天说的,你要先计算出整个音乐的长度,然后再对进度条进行处理。具体怎样用进度条的控件,请看书……


浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 16:45
guoxhvip
Rank: 8Rank: 8
来 自:聖西羅南看臺
等 级:贵宾
威 望:44
帖 子:4052
专家分:135
注 册:2006-10-8
收藏
得分:0 

愛生活 && 愛編程
2007-09-07 00:05
tntzwc
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:216
专家分:0
注 册:2007-4-28
收藏
得分:0 

以后我也做这个。
不错。
可不可以推荐一下,做哪方面的例子。


努力了有可能失败,不努力一定失败!
2007-09-07 13:47
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 
例子???想到什么就做什么好了,能想到的东西就想办法用代码解决。

浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-07 13:49
wzerolai
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2007-5-14
收藏
得分:0 
楼主:
如果想获得作者的名字那应如果编写呢
请楼主帮帮忙
2007-09-08 10:11
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 

你可以通过这个类来实现,具体的方法你查一下msdn吧。
FileVersionInfo fileVer = FileVersionInfo.GetVersionInfo( 文件 );
这里可以获得公司名,版本号,语言版本,版权等等

如果你要获得作者名,标题、作者等的话就需要引入“Microsoft Shell Controls and Automation”这个COM,这个是由系统Shell32提供的,下面我提供一个类的源代码,你参考一下吧。

using Shell32; // Use this namespace after add the reference
/// <summary>
  /// Returns the detailed Information of a given file.
/// </summary>
public class CFileInfo
{
private string sFileName ="",
sFullFileName="",
sFileExtension="",
sFilePath = "",
sFileComment = "",
sFileAuthor = "",
sFileTitle = "",
sFileSubject = "",
sFileCategory = "",
sFileType = "";

private long lFileLength = 0,
lFileVersion = 0;

private DateTime dCreationDate,
dModificationDate;

public CFileInfo(string sFPath)
{

// check if the given File exists
if(File.Exists(sFPath))
{
ArrayList aDetailedInfo = new ArrayList();
FileInfo oFInfo = new FileInfo(sFPath);
sFileName = oFInfo.Name;
sFullFileName = oFInfo.FullName;
sFileExtension = oFInfo.Extension;
lFileLength=oFInfo.Length;
sFilePath = oFInfo.Directory.ToString();
dCreationDate = oFInfo.CreationTime;
dModificationDate = oFInfo.LastWriteTime;
#region "read File Details"
aDetailedInfo = GetDetailedFileInfo(sFPath);
foreach(DetailedFileInfo oDFI in aDetailedInfo)
{
switch(oDFI.ID)
{
case 2:
sFileType = oDFI.Value;
break;
case 9:
sFileAuthor = oDFI.Value;
break;
case 10:
sFileTitle = oDFI.Value;
break;
case 11:
sFileSubject = oDFI.Value;
break;
case 12:
sFileCategory = oDFI.Value;
break;
case 14:
sFileComment = oDFI.Value;
break;
default:
break;
}
}
#endregion
}
else
{
throw new Exception("The given File does not exist");
}
}

#region "Properties"

public string FileName
{
get{return sFileName;}
set{sFileName=value;}
}
public string FilePath
{
get{return sFilePath;}
set{sFilePath = value;}
}
public string FullFileName
{
get{return sFullFileName;}
set{sFullFileName=value;}
}
public string FileExtension
{
get{return sFileExtension;}
set{sFileExtension=value;}
}
public long FileSize
{
get{return lFileLength;}
set{lFileLength=value;}
}
public long FileVersion
{
get{return lFileVersion;}
set{lFileVersion=value;}
}
public DateTime FileCreationDate
{
get{return dCreationDate;}
set{dCreationDate=value;}
}
public DateTime FileModificationDate
{
get{return dModificationDate;}
set{dModificationDate=value;}
}
public string FileType
{
get{return sFileType;}
}
public string FileTitle
{
get{return sFileTitle;}
}
public string FileSubject
{
get{return sFileSubject ;}
}
public string FileAuthor
{
get{return sFileAuthor ;}
}
public string FileCategory
{
get{return sFileCategory ;}
}
public string FileComment
{
get{return sFileComment ;}
}
#endregion
#region "Methods"
private ArrayList GetDetailedFileInfo(string sFile)
{
ArrayList aReturn = new ArrayList();
if(sFile.Length>0)
{
try
{
// Creating a ShellClass Object from the Shell32
ShellClass sh = new ShellClass();
// Creating a Folder Object from Folder that inculdes the File
Folder dir = sh.NameSpace( Path.GetDirectoryName( sFile ) );
// Creating a new FolderItem from Folder that includes the File
FolderItem item = dir.ParseName( Path.GetFileName( sFile ) );
// loop throw the Folder Items
for( int i = 0; i < 30; i++ )
{
// read the current detail Info from the FolderItem Object
//(Retrieves details about an item in a folder. For example, its size, type, or the time of its last modification.)
// some examples:
// 0 Retrieves the name of the item.
// 1 Retrieves the size of the item.
// 2 Retrieves the type of the item.
// 3 Retrieves the date and time that the item was last modified.
// 4 Retrieves the attributes of the item.
// -1 Retrieves the info tip information for the item.
string det = dir.GetDetailsOf( item, i );
// Create a helper Object for holding the current Information
// an put it into a ArrayList
DetailedFileInfo oFileInfo = new DetailedFileInfo(i,det);
aReturn.Add(oFileInfo);
}
}
catch(Exception)
{
}
}
return aReturn;
}
#endregion
}
// Helper Class from holding the detailed File Informations
// of the System
public class DetailedFileInfo
{
int iID = 0;
string sValue ="";
public int ID
{
get{return iID;}
set
{
iID=value;
}
}
public string Value
{
get{return sValue;}
set{sValue = value;}
}
public DetailedFileInfo(int ID, string Value)
{
iID = ID;
sValue = Value;
}
}

[此贴子已经被作者于2007-9-8 13:00:31编辑过]


浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-08 12:44
wzerolai
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2007-5-14
收藏
得分:0 

不过有点夸张,但都要谢谢楼主的帮助.

2007-09-09 00:12
hqu007
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-9-3
收藏
得分:0 
呵呵,多谢楼主分享啊,不过技术难点已经解决
2007-09-20 19:41
drychq
Rank: 1
等 级:新手上路
帖 子:114
专家分:0
注 册:2007-10-30
收藏
得分:0 
我在COM中添加Windows Media Player的组件后找不到
我在COM中添加Windows Media Player的组件后
   为什么在工具箱里找不到啊
   是怎么回事啊
2007-12-22 21:24
快速回复:[开源]用Windows Media Player控件播放音乐图文教程(MP3,WAV,WMV) ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027141 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved