i.e, your software can notify the user if his driver does not support his request BEFORE something bad (GPF) happens.
And ony because I am in a really good mood today...
Code:
' get version of of any file 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 FUNCTION = STR$(Major) & "." & TRIM$(STR$(Minor)) & "." & LTRIM$(STR$(Build)) ' & "." & LTRIM$(STR$(SubBuild)) END FUNCTION
MCM
Leave a comment: