尋找了許久,找到了這個介面,感謝大佬做出的貢獻。
char* szfilename = "c:\\windows\\system32\\cmd.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為英文
messagebox(strtranslation);
//檔案描述
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);
//版權
verqueryvalue(pblock,strsubblock.getbuffersetlength(256),(lpvoid*)&pvervalue,&nsize);
strsubblock.releasebuffer();
strtemp.format("版權: %s ",pvervalue);
afxmessagebox(strtemp);
//公司名
strsubblock.format("\\stringfileinfo\\%s\\companyname",strtranslation);
verqueryvalue(pblock,strsubblock.getbuffersetlength(256),(lpvoid*)&pvervalue,&nsize);
strsubblock.releasebuffer();
strtemp.format("公司名: %s ",pvervalue);
afxmessagebox(strtemp);
free(pblock);
C Windows讀寫INI檔案
c windows讀寫ini檔案 一 將資訊寫入到ini檔案 所用函式 bool writeprivateprofilestring lpcstr lpkeyname,lpcstr lpstring,lpcstr lpfilename 引數說明 ini檔案中欄位名 lpcstr lpkeyname ...
讀取Excel檔案的版本
讀取xls檔案和xlsx檔案建立的版本號。雖然xlsx宣告的是向前相容,但是不知道oledb是不是也是這樣,沒有辦法所以要讀取檔案版本,限定只能讀取excel2007儲存的檔案。1 using icsharpcode.sharpziplib.zip 23 public const ushort bi...
VC讀取檔案的檔案版本號
vc版本 char szfilename c dword dwsize getfileversioninfosize szfilename,null lpvoid pblock malloc dwsize getfileversioninfo szfilename,0,dwsize,pblock c...