Hello!
I would like to get the version number for my application as it starts up. This is what I have so far but I doubt I'm doing it correctly...
GetVersionInfo proc
invoke FindResource,NULL,1,RT_VERSION
.if eax != NULL
invoke LoadResource,NULL,eax
.if eax != NULL
mov eax,(VS_FIXEDFILEINFO ptr [eax]).dwProductVersionMS
invoke wsprintf,addr buffer,addr szNum,eax
invoke MessageBox,hWin,addr buffer,addr AppName,0
.endif
.endif
xor eax,eax
Ret
GetVersionInfo EndP
M$ says:
QuoteLoad Resource returns a handle to the global memory block containing the data associated with the resource.
My question is, how do I access the various memebers of the VS_FIXEDFILEINFO? Is the handle to the global memory block in fact pointing to this structure?
Any assistance/suggestions will be appreciated!
As long as the version information is standard, you use the following
LOCAL Verification:DWORD
LOCAL RootPath:DWORD
LOCAL pVersion:DWORD
LOCAL pVersionLen:DWORD
LOCAL pProdName:DWORD
LOCAL szMyProgram[MAX_PATH]:BYTE
invoke GetModuleFileName,NULL,addr szMyProgram,MAX_PATH
invoke GetFileVersionInfoSize,addr szMyProgram,OFFSET Verification
or eax,eax
jz FAILED
push eax
invoke GlobalAlloc,GPTR,eax
mov ebx,eax
pop eax
invoke GetFileVersionInfo,addr szMyProgram,NULL,eax,ebx
mov [RootPath],"\"
invoke VerQueryValue,ebx,addr RootPath,addr pVersion,addr pVersionLen
invoke VerQueryValue,ebx,addr ProductQuery,addr pProdName,addr pVersionLen
; pVersion points to the packed version information
invoke GlobalFree,ebx
xor eax,eax
ret
FAILED:
;some error message
ret
Thank you!