AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Interface implementieren...

Ein Thema von barnti · begonnen am 20. Aug 2004 · letzter Beitrag vom 11. Jun 2005
 
barnti

Registriert seit: 15. Aug 2003
Ort: Mal hier mal da...
689 Beiträge
 
Delphi 7 Enterprise
 
#1

Interface implementieren...

  Alt 20. Aug 2004, 09:01
Hallo,
ich versuche immer noch meine Klasse für die 'FileInfo' zu erstellen. Hier ein Teil des Codes:
Delphi-Quellcode:
unit Versioninfo;

interface
uses
  Types,windows,SysUtils;
type
  TVersionInfo=class

  private
    FStandardKeys:array[0..9] of String; // Beinhaltet Alle FileInfos

    function GetVersioninfo(Index: Integer): String;
    function GetKey(KeyName: String): String;
    procedure SetVersionInfo(const Index: Integer; const Value: String);
    function GetBuildNumber: String;
  public
    constructor Create (ThisSourceFile: String);
    destructor Destroy; override;

    property Key[KeyName: String]: String read GetKey;

    property CompanyName: String index 0 read GetVersionInfo write SetVersionInfo;
    property FileDescription: String index 1 read GetVersionInfo;
    property FileVersion: String index 2 read GetVersionInfo;
    property InternalName: String index 3 read GetVersionInfo;
    property Copyright: String index 4 read GetVersionInfo;
    property TradeMarks: String index 5 read GetVersionInfo;
    property OriginalFileName: String index 6 read GetVersionInfo;
    property ProductName: String index 7 read GetVersionInfo write SetVersionInfo;
    property ProductVersion: String index 8 read GetVersionInfo write SetVersionInfo;
    property Comments: String index 9 read GetVersionInfo;
    property BuildNumber: String read GetBuildNumber;

    // Hier versuche ich auf die Eigenschaften zuzugreifen. Leider schlägt das Kompilieren fehl:
    // [Error] Versioninfo.pas(35): Incompatible types
    property StandardKeys[index: Integer]: String read GetVersionInfo write SetVersionInfo;
    
  end;

implementation

{ TVersionInfo }
const MaxVersionKeys= 9;
constructor TVersionInfo.Create(ThisSourceFile: String);
const
  VersionkeyNames: array[0..MaxVersionKeys] of String = ('CompanyName',
  'FileDescription','FileVersion','InternalName','Copyright','TradeMarks',
  'OriginalFileName','ProductName','ProductVersion','Comments');
var
  ThisInfo: Integer;
  InfoLength: UInt64;
  Len, Handle: DWord;
  PCharset: PLongint;
  LangCharset: String;
  InfoAvailable: Boolean;
begin
  inherited Create;

  // Get size of version info
  Len:= GetFileVersionInfoSize(PChar(ThisSourceFile),Handle);

  // Allocate VersionInfo buffer size
  SetLength(VersionInfo, Len+1);

  //Get version info
  if GetFileVersionInfo(PChar(ThisSourceFile), Handle,Len,Pointer(VersionInfo))
  then
  begin
    if VerQueryValue(Pointer(VersionInfo),'\VarFileInfo\Translation',
    Pointer(PCharSet),Len)then
    begin
      LangCharset:= Format('%.4x%.4x',[LoWord(PCharset^),HiWord(PCharset^)]);
      InfoAvailable:= true;
      for ThisInfo:=0 to MaxVersionKeys do
      begin
        // Hier sollen die Informationen übernommen werden...
        StandardKeys[ThisInfo]:= GetKey(VersionKeyNames[ThisInfo]);
      end;
    end;
 end;
end;

destructor TVersionInfo.Destroy;
begin

  inherited;
end;

function TVersionInfo.GetBuildNumber: String;
begin

end;

function TVersionInfo.GetKey(KeyName: String): String;
var
  
begin

end;

function TVersionInfo.GetVersioninfo(Index: Integer): String;
begin
  result:= FStandardKeys[Index]
end;

procedure TVersionInfo.SetVersionInfo(const Index: Integer;
  const Value: String);
begin
  FStandardKeys[Index]:= Value;
end;

end.
Kann jemand helfen? Ich versuche die File info im Konstruktor in die Variable 'StandardKeys' zu schreiben...
Gruß,

Barnti
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:52 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz