在win2000\xp,我知道一个文件的完整路径,如何获取他的属性中的“常规“和“摘要“信息(用代码实现)。

解决方案 »

  1.   

    常规信息:CFile::GetStatus 
    摘要信息:VS_FIXEDFILEINFO *lpInfo;
    DWORD  dw;
    DWORD  dwSize = GetFileVersionInfoSize( szFile, &dw ); //szFile中存放你的文件名,包括路径LPVOID lpData = (LPVOID)new char[dwSize];
    GetFileVersionInfo( szFile, 0, dwSize, lpData );UINT ui;
    VerQueryValue( lpData, "\\", (LPVOID*)&lpInfo, &ui );//例如版本号
    iVerMajor = HIWORD( lpInfo->dwFileVersionMS );
    iVerMinor = LOWORD( lpInfo->dwFileVersionMS );
    iVerBuildTimes = LOWORD( lpInfo->dwFileVersionLS );
    //其它内容,可以参照msdn中的VerQueryValue取得...
      

  2.   

    用API函数肯定可以:
    BOOL GetFileAttributesEx(
      LPCTSTR lpFileName,        // pointer to string that specifies a 
                                 // file or directory
      GET_FILEEX_INFO_LEVELS fInfoLevelId, 
                                 // value that specifies the type of 
                                 // attribute information to obtain
      LPVOID lpFileInformation   // pointer to buffer to receive 
                                 // attribute information
    );
     
      

  3.   

    FindFirstFile()
    FindNextFile()
    FindClose()
      

  4.   

    http://www.vckbase.com/code/downcode.asp?id=1199