Einzelnen Beitrag anzeigen

Whookie

Registriert seit: 3. Mai 2006
Ort: Graz
441 Beiträge
 
Delphi 10.3 Rio
 
#1

E2232 Interface 'x' besitzt keine Interface-Identifikation?

  Alt 20. Jul 2015, 12:40
Delphi-Version: XE8
Hänge gerade an einem Interface - Problem und verstehe nicht wieso ich den E2232 Fehler (oder im Alternativfall kein Interface bekomme)!

Folgendes leeres Delphi VCL Projekt (leere Form):
Delphi-Quellcode:
unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm2 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}


Const
  MyIntfAGuid: TGuid = '{23D5751F-8368-4672-ACFC-3BF667F1F544}';

Type
  IMyIntfA = Interface
    [MyIntfAGuid]
    procedure foo;
  End;


  TMyClass = Class(TInterfacedObject, IMyIntfA)
    procedure foo;
  End;



{ TMyClass }

procedure TMyClass.foo;
begin
end;

procedure TForm2.FormCreate(Sender: TObject);
var
  LMy: TMyClass;
  LIMyA: IMyIntfA;
  x: Integer;
begin
  LMy := TMyClass.Create;

  // so gibts E2232
  if Supports(LMy, IMyIntfA) then
  begin
    x := 3;
  end;

  // so gibts kein Interface
  if LMy.QueryInterface(MyIntfAGuid, LIMyA) = S_OK then
  begin
    x := 3;
  end;


  LMy.Free;
end;

end.

Irgendwas mache ich offensichtlich falsch....?
Whookie

Software isn't released ... it is allowed to escape!
  Mit Zitat antworten Zitat