char fliter[]="音乐文件(*.mp3;*.wma;*.wav)\0*.mp3;*.wma;*.wav\0"
"所有文件(*.*)\0*.*\0\0";
CFileDialog fdlg(TRUE);
fdlg.m_ofn.lpstrFilter=fliter;
if(IDOK==fdlg.DoModal())
{
CString path=fdlg.GetPathName();
CString file=fdlg.GetFileName();
list.InsertString(list.GetCount(),path);
CClientDC dc(this);
上面是添加部分的名字
添加到list和filename
CString file=fdlg.GetFileName();以后用substring过滤下
用CString的成员函数reverseFind /, 然后再用Right函数
The name of the file includes both the prefix and the extension. For example, GetFileName will return "TEXT.DAT" for the file C:\FILES\TEXT.DAT.
获取后就是去除后缀名即可。。