VC讀取檔案的檔案版本號

2021-06-21 16:21:06 字數 2489 閱讀 1020

//vc版本

char* szfilename = 「c:

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);

修改ipa檔案版本號

對於開發者來說,給使用者提供ipa檔案,使用者可以要你修改下版本號,選擇是公升級還是維持目前版本。遇到這種情況我們可以重新打包,不過僅僅是修改版本號就重新打包,似乎又心有不甘。那麼問題來了,有沒有辦法直接在ipa檔案中修改版本號呢?下面分析一下 1.ipa版本號就在包中的info.plist檔案中,...

style,script檔案版本號處理

寫 的時候經常會遇到修改了樣式檔案和指令碼檔案後但是沒有效果的問題,仔細檢視頁面dom結構的話會發現 仍然是你修改之前的 這就是瀏覽器歷史記錄快取的問題,碰到這種情況就必須強制重新整理頁面或者清除瀏覽器本地快取。但是這樣做是非常麻煩的,有時候要經常做這樣的操作難免會感到繁瑣。所以想著自己寫哥函式來解...

C 讀取exe版本號

通常我們做軟體自動更新,需要比較新檔案與舊檔案的版本號,如果新檔案的版本號比舊檔案高,就替換舊檔案。版本號一般是在visual studio的程式資訊裡定義 如果使用以下的方法 using system.reflection using system.io assembly currentassem...