Notice this was a thread resurrected by Colin, not me

Although I gotta admit when I first saw the title and my name attached to it, I started scratching my head cause I solved the problem about 20 months ago

LOCAL FilePath AS ASCIIZ * %MAX_PATH LOCAL VerSize, VerCheck AS DWORD LOCAL VerPtr AS DWORD PTR LOCAL Version AS STRING LOCAL Work AS STRING LOCAL Major, Minor, Build, Compile AS LONG LOCAL VersionInfo AS VS_FIXEDFILEINFO PTR FilePath = EXE.FULL$ VerPtr = VARPTR(VerCheck) VerSize = GetFileVersionInfoSize(FilePath, VerPtr) Major=0: Minor = 0: Build = 0: Compile = 0 IF VerSize > 0 THEN Version = SPACE$(VerSize) VerCheck = GetFileVersionInfo(FilePath, %NULL, VerSize, BYVAL STRPTR(Version)) VerQueryValue BYVAL STRPTR(Version), "\", VersionInfo, SIZEOF(@VersionInfo) Major = @VersionInfo.dwProductVersionMs \ &h10000 Minor = @VersionInfo.dwProductVersionMs MOD &h10000 Build = @VersionInfo.dwProductVersionLS \ &h10000 Compile = @VersionInfo.dwProductVersionLS MOD &h10000 END IF Work = "ProgramName: "& FORMAT$(Major) &"."& FORMAT$(Minor) _ &"."& FORMAT$(Build) &"."& FORMAT$(Compile)
hDll = GetModuleHandle ("mydll.dll") GetModuleFileNAme hDll, szLib, SIZEOF(szLib) sVersion = FileVersionString (szLib)
#COMPILE EXE "My_main_exe.exe" ..... hDll = GetModuleHandle ("mydll.dll") GetModuleFileNAme hDll, szLib, SIZEOF(szLib) sVersion = FileVersionString (szLib)
#COMPILE DLL GLOBAL g_hInstance AS LONG FUNCTION LibMain (hInst, other stuff) ..... DLL_Process_Attach g_hinstance = hInst .... FUNCTION ThisDllsInstanceHandle () EXPORT AS LONG FUNCTION = g_hInstance END FUNCTION ...
' Get version string of current Executable. Use FileVersionString to get for another file. ' return program version string from resource file as "Major.minor build nnnn" ' changed 5/27/03 to return major.minor.build, build used to be format$=0000, now it's just ' a number. e.g., was "2.2 Build 0003" now is "2.2.3" ' STANDARD PROGRAM VERSION STRING format: major.minor.build FUNCTION ProgramVersionString() AS STRING LOCAL major AS LONG, Minor AS LONG, Build AS LONG LOCAL szFile AS ASCIIZ * %MAX_PATH LOCAL ResSize AS LONG LOCAL ffi AS VS_FIXEDFILEINFO PTR LOCAL ret AS LONG LOCAL Buffer AS STRING, DLLDate AS STRING Major=0: Minor = 0: Build = 0 GetModuleFileName BYVAL %NULL, szFile, SIZEOF(szFile) ResSize = GetFileVersionInfoSize (szFile, ret) IF ResSize= 0 THEN FUNCTION = "Error" EXIT FUNCTION END IF Buffer = SPACE$(ResSize) Ret = GetFileVersionInfo(szFile, %NULL, ResSize, BYVAL STRPTR(Buffer)) ' ** Read the VS_FIXEDFILEINFO info VerQueryValue BYVAL STRPTR(Buffer), "\", ffi, SIZEOF(@ffi) Major = @ffi.dwProductVersionMs \ &h10000 Minor = @ffi.dwProductVersionMs MOD &h10000 Build = @ffi.dwProductVersionLS FUNCTION = LTRIM$(STR$(Major)) & "." & TRIM$(STR$(Minor)) & "." & LTRIM$(STR$(Build)) END FUNCTION ' get version of any file ' removed leading space from major 8/24/07 FUNCTION FileVersionString(szFile AS ASCIIZ) AS STRING LOCAL major AS LONG, Minor AS LONG, Build AS LONG, SubBuild AS LONG LOCAL ResSize AS LONG LOCAL ffi AS VS_FIXEDFILEINFO PTR LOCAL ret AS LONG LOCAL Buffer AS STRING, DLLDate AS STRING Major=0: Minor = 0: Build = 0 ResSize = GetFileVersionInfoSize (szFile, ret) IF ResSize= 0 THEN FUNCTION = "No Version Info" EXIT FUNCTION END IF Buffer = SPACE$(ResSize) Ret = GetFileVersionInfo(szFile, %NULL, ResSize, BYVAL STRPTR(Buffer)) ' ** Read the VS_FIXEDFILEINFO info VerQueryValue BYVAL STRPTR(Buffer), "\", ffi, SIZEOF(@ffi) Major = @ffi.dwProductVersionMs \ &h10000 Minor = @ffi.dwProductVersionMs MOD &h10000 Build = @ffi.dwProductVersionLS MOD &h10000 ' this is for MY software which uses VERSION_MAJOR, VERSION_MINOR, 0, VERSION_BUILD under FILEVERSION ' SubBuild = @ffi.dwProductVersionLS \ &h10000 ' combine ' 8/24/07 WAS: FUNCTION = STR$(Major) & "." & TRIM$(STR$(Minor)) & "." & LTRIM$(STR$(Build)) ' & "." & LTRIM$(STR$(SubBuild)) ' changed to: (to remove leading space) FUNCTION = FORMAT$(Major) & "." & FORMAT$(Minor) & "." & FORMAT$(Build) ' & "." & FORMAT$(SubBuild) END FUNCTION
#include "resource.h" // * Version info. // // VS_VERSION_INFO VERSIONINFO FILEVERSION 5, 0, 0, 0 PRODUCTVERSION 5, 0, 0, 0 FILEOS VOS_WINDOWS32 FILETYPE VFT_APP BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" //Does this have to be this value or what does the value mean? BEGIN VALUE "CompanyName", "Your Company, Inc.\000" VALUE "FileDescription", "Program Desc\000" VALUE "FileVersion", "05.00.0000\000" VALUE "InternalName", "Internal Name\000" VALUE "OriginalFilename", "Original Name.EXE\000" VALUE "LegalCopyright", "Copyright \251 2007 Your Company, Inc.\000" VALUE "ProductName", "Program Name\000" VALUE "ProductVersion", "05.00.0000\000" VALUE "Comments", "Yadda Yadda\000" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 0x4B0 END END
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: