sbondalapati
asked on
Version.dll problem in delphi 2010 application
HI,
I developed a delphi application on Delphi 2010 and windows xp 32bit version. It uses the Version.dll to get the version of another exe. When i try to run the same application in Windows 7 64 bit version it is throwing an error some thing like problem with Version.dll. Please tell me how to resolve this?
I developed a delphi application on Delphi 2010 and windows xp 32bit version. It uses the Version.dll to get the version of another exe. When i try to run the same application in Windows 7 64 bit version it is throwing an error some thing like problem with Version.dll. Please tell me how to resolve this?
ASKER
will this code works with both 32bit os and 64bit os.
ASKER
GetFileVersionInfo (PChar (ExecFile), 0, Size, Pt);
VerQueryValue (Pt, '\', Pt2, Size);
both the above functions will use version.dll which is platform dependent. if you have any other solution which is platform independent it will be useful.
VerQueryValue (Pt, '\', Pt2, Size);
both the above functions will use version.dll which is platform dependent. if you have any other solution which is platform independent it will be useful.
really ? it works for me on Vista64 as well as XP 32
I guess the problem is not 32 or 64 bits, but Windows 7
You are right on one point, it is API of version.dll, I never figured nor cared because it's all transparent in Delphi (it's defined in Windows.pas)
I'll check on MSDN if they say something about this & Seven
I guess the problem is not 32 or 64 bits, but Windows 7
You are right on one point, it is API of version.dll, I never figured nor cared because it's all transparent in Delphi (it's defined in Windows.pas)
I'll check on MSDN if they say something about this & Seven
can you specify which error do you get ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
find the image
Sans-titre.png
Sans-titre.png
that is a pointer problem. I guess it's a an incompatibility with unicode and/or code compiled with Delphi 2010.
If not done already, can you check with the second version I provided ?
can you trace the exact function call that is throwing this error ?
If not done already, can you check with the second version I provided ?
can you trace the exact function call that is throwing this error ?
ASKER
Thanks. Your second version worked perfectly on 2 different types of windows.
It first declares a type TVersion : version of a file as a record of 4 integer values
Var Version:TVersion;
If you want the TVersion of a file, use
Version:=GetAppVersion('My
if you want to convert a TVersion into a string, you can use
Caption:=VersionStr(Versio
GetModuleVersion will do that in one step. if you give it a filename as parameter, it will give you the string version of it. If you don't, or use an empty string parameter (default value), it will return the version of the current module. a module is either the Exe, or the dll, bpl etc .
So easiest way to get the current app version as a string is :
Caption:=GetModuleVersion;
This module file name is get by calling the windows API GetModuleFileName, using the instance number of the module. In all Delphi module, this is a global variable called hInstance .
IF you add this code in a dll or bpl and use it from another application or module, beware that GetModuleVersion will return the version of the dll/bpl where lies this code, not the calling module. To do so, you have to use GetInstanceVersion with hInstance (which will refer to the calling instance)
Caption:=GetInstanceVersio
Open in new window