DWORD dwVerInfoSize = 0;
    AnsiString szFile = Application->ExeName;
    dwVerInfoSize = GetFileVersionInfoSize(szFile.c_str(), &dwVerInfoSize);
    if(dwVerInfoSize > 0) {
        BYTE *bVerInfoBuf = new BYTE[dwVerInfoSize];
        if (GetFileVersionInfo(szFile.c_str(), 0, dwVerInfoSize, bVerInfoBuf)) {
            VS_FIXEDFILEINFO *vsInfo;
            UINT vsInfoSize;
            if (VerQueryValue(bVerInfoBuf, "\\", (void**)&vsInfo, &vsInfoSize)) {
                int iFileVerMajor   = HIWORD(vsInfo->dwFileVersionMS);
                int iFileVerMinor   = LOWORD(vsInfo->dwFileVersionMS);
                int iFileVerRelease = HIWORD(vsInfo->dwFileVersionLS);
                int iFileVerBuild   = LOWORD(vsInfo->dwFileVersionLS);
                Caption = Caption + " ("
                          + IntToStr(iFileVerMajor) + "."
                          + IntToStr(iFileVerMinor) + "."
                          + IntToStr(iFileVerRelease) + "."
                          + IntToStr(iFileVerBuild)
                          + ")";
            }
        }
        delete bVerInfoBuf;
    }

創作者介紹

邱小新の工作筆記

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()