VC得到指定文件的详细信息/属性
2010-11-11 11:56
417 查看
char* szFileName = “C://EnochShen.exe”; DWORD dwSize = GetFileVersionInfoSize(szFileName,NULL); LPVOID pBlock = malloc(dwSize); GetFileVersionInfo(szFileName,0,dwSize,pBlock);
char* pVerValue = NULL; UINT nSize = 0; VerQueryValue(pBlock,TEXT(“//VarFileInfo//Translation”), (LPVOID*)&pVerValue,&nSize);
CString strSubBlock,strTranslation,strTemp; strTemp.Format(“000%x”,*((unsigned short int *)pVerValue)); strTranslation = strTemp.Right(4); strTemp.Format(“000%x”,*((unsigned short int *)&pVerValue[2])); strTranslation += strTemp.Right(4); //080404b0为中文,040904E4为英文
//文件描述 strSubBlock.Format(“//StringFileInfo//%s//FileDescription”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“文件描述: %s”,pVerValue); AfxMessageBox(strTemp);
//内部名称 strSubBlock.Format(“//StringFileInfo//%s//InternalName”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“文件描述: %s”,pVerValue); AfxMessageBox(strTemp);
//合法版权 strSubBlock.Format(“//StringFileInfo//%s//LegalTradeMarks”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“合法版权: %s”,pVerValue); AfxMessageBox(strTemp);
//原始文件名 strSubBlock.Format(“//StringFileInfo//%s//OriginalFileName”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“原始文件名: %s”,pVerValue); AfxMessageBox(strTemp);
//产品名称 strSubBlock.Format(“//StringFileInfo//%s//ProductName”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“产品名称: %s”,pVerValue); AfxMessageBox(strTemp);
//产品版本 strSubBlock.Format(“//StringFileInfo//%s//ProductVersion”,strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format(“产品版本: %s”,pVerValue); AfxMessageBox(strTemp);
free(pBlock);
转载请说明出处:http://blog.csdn.net/mycaibo
相关文章推荐
- vc++读取文件属性的详细信息描述 读取QQ的注册表路径
- vc++读取文件属性的详细信息描述 通过读取QQ的注册表和EXE路径两种方式
- 说明: 在处理向该请求提供服务所需的配置文件时出错。请检查下面的特定错误详细信息并适当地修改配置文件。 分析器错误信息: 无法识别的属性“type”。
- 如何得到指定表的各种属性信息如下:
- 得到指定文件的信息
- PHP遍历指定目录,并存储目录内所有文件属性信息
- SQL语句(sp_helpdb)查看数据库属性信息,查看数据库文件路径用得到
- 用windows media player打开mp3文件时提示,找不到指定模块;并且鼠标指向音乐文件时不能显示详细的文件信息,如位速等
- vc 得到软件的版本信息 资源文件中的../Version/VS_VERSION_INFO/FILEVERSION的值
- 获取文件属性中详细信息里的各项目(vb 学习备注)
- 使用ShellClass获取文件属性详细信息
- VC编程改变指定的文件或文件夹的属性
- 得到属性文件信息
- 如何在跨平台的情况下获取可执行文件的详细信息和属性
- VerQueryValue获取文件-属性-详细信息
- VS设置程序集属性(文件的详细信息)
- FAQ200412:得到指定文件的信息
- 【dumpe2fs】显示文件系统属性信息(更加详细)
- 使用ShellClass获取文件属性详细信息的实现方法
- spl处理文件(文件详细信息、文件遍历、查询指定行、写入CSV文件)