FUNCTION GetBuildNumber LPARAMETER cExeFile LOCAL cVersionInfoStructure, nBytes, nBuildInfoStartPos, nBuildInfoLength, cResult * these are the API functions with parameters from WIN32API.HLP DECLARE LONG GetFileVersionInfoSize IN VERSION STRING, LONG * LPTSTR lptstrFilename, // pointer to filename string * LPDWORD lpdwHandle // pointer to variable to receive zero DECLARE GetFileVersionInfo IN VERSION STRING, LONG, LONG, STRING * LPTSTR lptstrFilename, // pointer to filename string * DWORD dwHandle, // ignored * DWORD dwLen, // size of buffer * LPVOID lpData // pointer to buffer to receive file-version info. * find out the length of the version info structure nBytes = GetFileVersionInfoSize(@cExeFile, 0) IF EMPTY(nBytes) cResult = '' ELSE * retrieve the version info structure cVersionInfoStructure = SPACE(nBytes) = GetFileVersionInfo(@cExeFile, 0, @nBytes, @cVersionInfoStructure) * extract the substring with the build number nBuildInfoStartPos = ATCC('FileVersion', cVersionInfoStructure) + LEN('FileVersion') + 1 * build info terminated by CHR(0) nBuildInfoLength = AT(CHR(0), SUBSTR(cVersionInfoStructure, nBuildInfoStartPos)) - 1 cResult = SUBSTR(cVersionInfoStructure, nBuildInfoStartPos, nBuildInfoLength) ENDIF CLEAR DLLS RETURN cResult ENDFUNC