CFileDialog xfile(TRUE,"TXT",NULL,0,"Text files(*.txt)|*.TXT|",NULL);
m_filename=xfile.GetFileName();
请问各位,例如我要打开文本文件的名字是 la.txt
但是我要得到名字时m_filename的名字,我不想包括类型,只要得到la,不通过字符串处理,有其他办法吗?另外在文件打开的对话框中,如何显示所有类型的文件,而不仅仅是显示txt的文件,该怎么办?谢谢了

解决方案 »

  1.   

    CFileDialog xfile(TRUE,"TXT",NULL,0,"Text files(*.*)|*.*|",NULL);
    显示所有类型的文件
      

  2.   

    CFileDialog xfile(TRUE,NULL,NULL,0,"All files(*.*)|*.*||",NULL);
      

  3.   

    CFileDialog::GetFileTitle
    Call this member function to retrieve the title of the filename entered in the dialog box. The title of the filename includes both the name and the extension.CFileDialog::GetFileName
    Call this member function to retrieve the name of the file entered in the dialog box. The name of the file includes only its prefix, without the path or the extension.
      

  4.   

    问题1:
    CFileDialog xfile(TRUE,"TXT",NULL,0,"Text files(*.*)|*.*|",NULL);
    显示所有类型的文件CString str;
    str = m_fileName.left(m_filename.ReserveFind('.'));