FindFirstFile() 函数可以设定条件为同时查找 当前目录下的所有*.jpg与*.gif吗?怎么写的?

解决方案 »

  1.   

    CFileFind   tempFind;
    CString path="d:\\temp\\*.*";
    CString strFileName, strSuffix, strFilePath;
    int nIndex;
    CString           strAVI;

    BOOL bIsFinded =(BOOL)tempFind.FindFile( path );
    while( bIsFinded )
    {
    bIsFinded = (BOOL)tempFind.FindNextFile();
    if( !tempFind.IsDots() ) 
    {
    strFileName = tempFind.GetFileName();
    nIndex = strFileName.ReverseFind('.');     
    strSuffix = strFileName.Mid(nIndex+1);
    strSuffix.MakeUpper();
    if ( strSuffix == "JPG" ) 
    {
     strAVI =  strFileName;    
    }
    }
    }
    tempFind.Close();
      

  2.   

    可以查找所有的再判断
    if(strFileName.Right(4)==".JPG" ||strFileName.Right(4)==".BMP" )
    {
    ......
    }strFileName是你查找到的文件名
      

  3.   

    写错了,是if(strFileName.Right(4)==".jpg" ||strFileName.Right(4)==".gif" )