Board index » delphi » Displaying Delphi Build No. in About box / using HTML help files in Delphi 4

Displaying Delphi Build No. in About box / using HTML help files in Delphi 4

I have just started using Delphi V4 Standard Edition.

I noticed that under the Project | Options menu, there is a 'Version Info'
tab which shows information such as build number, etc.
Is it possible to display any of this information from within a program, (in
the about box for example)?

Also, is it possible to use HTML help files instead of Windows help (.HLP)
files with Delphi and still retain context sensitivity?
If so how would I go about this?
If not - can anyone recommend a good help file creation program?

---
Thanks in advance

Marcus

 

Re:Displaying Delphi Build No. in About box / using HTML help files in Delphi 4


Hi,
here is a unit with a function that you need!

Use it like that:
prodVerion := GetVersionInfo('ProductVersion');
copyright := GetVersionInfo('LegalCopyright');
etc.

Best regards,
Peppy

---------

unit UnitVerInfo;
interface

  function GetVersionInfo (const about : string) : PChar;

implementation
uses SysUtils, Windows;

var FVData  : pointer;
  findBlock : string;

procedure InitVersionInfo;
var fvSize : integer;
  appFName : array [0..255] of char;
  FVResult : pointer;
  FVHandle : DWORD;
begin
  GetModuleFileName(HInstance, appFName, sizeof(appFName));
  OemToAnsi(appFName, appFName);

  fvSize := GetFileVersionInfoSize(appFName, FVHandle);
  if (fvSize=0) then exit;

  GetMem(FVData,fvSize);
  GetFileVersionInfo(appFName, FVHandle, fvSize, FVData);

  VerQueryValue(FVData, '\\VarFileInfo\\Translation', FVResult, fvSize);
  findBlock:='\\StringFileInfo\\'+
             Format('%4x%4x',[DWORD(FVResult^) and $FFFF, DWORD(FVResult^)
shr 16])+
             '\\%s';
  for FVSize:=1 to length(findBlock) do
    if findBlock[FVSize]=' ' then findBlock[FVSize]:='0';
end;

function GetVersionInfo (const about : string) : PChar;
var
  subBlockName : array [0..255] of char;
  FVResult : pointer;
  FVSize : integer;
begin
  StrFmt(subBlockName,PChar(findBlock),[about]);
  if (not VerQueryValue(FVData, subBlockName, FVResult, FVSize)) then
    Result:=nil
  else
    Result:=FVResult;
end;

initialization
  InitVersionInfo;

finalization
  if Assigned(FVData) then FreeMem(FVData);
end.

-------------

Quote
Marcus Clark <sales~nosp...@alfia.co.uk> wrote in message

news:7ecrbf$2b6$1@plug.news.pipex.net...
Quote
> I have just started using Delphi V4 Standard Edition.

> I noticed that under the Project | Options menu, there is a 'Version Info'
> tab which shows information such as build number, etc.
> Is it possible to display any of this information from within a program,
(in
> the about box for example)?

> Also, is it possible to use HTML help files instead of Windows help (.HLP)
> files with Delphi and still retain context sensitivity?
> If so how would I go about this?
> If not - can anyone recommend a good help file creation program?

> ---
> Thanks in advance

> Marcus

Re:Displaying Delphi Build No. in About box / using HTML help files in Delphi 4


Quote
> I noticed that under the Project | Options menu, there is a 'Version Info'
> tab which shows information such as build number, etc.
> Is it possible to display any of this information from within a program, (in
> the about box for example)?

Call this function..  I coded it for the app I am currently working on..  Got
it from somewhere else..  Minor revisions made..  Passes the build number back
as a string.

Regards,

Jeff

============  Code snippit start ==================

function TForm.GetVersion: String;
var
  InfoSize: DWORD;
  Wnd: HWND;
  VerBuf: Pointer;
  FI: PVSFixedFileInfo;
  VerSize: DWORD;
  chrAppName: PChar;
  strFullVersion: String;
  intMajor, intMinor: Integer;
  intRelease, intBuild: Integer;
begin
  chrAppName := PChar(Application.ExeName);
  InfoSize := GetFileVersionInfoSize(chrAppName, Wnd);
  strFullVersion := '';
  if InfoSize <> 0 then
  begin
    GetMem(VerBuf, InfoSize);
    try
      if GetFileVersionInfo(chrAppName, Wnd, InfoSize, VerBuf) then
        if VerQueryValue(VerBuf, '\', Pointer(FI), VerSize) then
        begin
          intMajor := HiWord(FI.dwFileVersionMS);
          intMinor := LoWord(FI.dwFileVersionMS);
          intRelease := HiWord(FI.dwFileVersionLS);
          intBuild := LoWord(FI.dwFileVersionLS);
          strFullVersion := IntToStr(intMajor) + '.' +
                            IntToStr(intMinor) + '.' +
                            IntToStr(intRelease) + '.' +
                            IntToStr(intBuild);
        end;
    finally
      FreeMem(VerBuf);
    end;
  end;
  Result := strFullVersion;
end;

============  Code snippit end================

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Other Threads