AGB  ·  Datenschutz  ·  Impressum  







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

Problem Mit Interface-Objekt

Ein Thema von DGS · begonnen am 26. Apr 2007 · letzter Beitrag vom 27. Apr 2007
 
HeikoDD

Registriert seit: 8. Okt 2003
11 Beiträge
 
#5

Re: Problem Mit Interface-Objekt

  Alt 27. Apr 2007, 20:59
vielleicht hilft das etwas, also bei mir läuft es unter d5 ohne probleme.

Delphi-Quellcode:
const IIDHaupt : TGUID = '{EA6A5E02-3B7D-458E-898D-101F76832635}';

type iHaupt = interface(IUnknown)
       ['{EA6A5E02-3B7D-458E-898D-101F76832635}']
       procedure MyLoop; stdcall;
     end;

////////////////////////////////////////////////////////////////////////////////
type tCustomClass = class(tObject)
       protected
         fApplet : Array of IHaupt;
         procedure SetIhaupt(Index:Integer; Value:IHaupt); stdcall;
         function GetIHaupt(Index:integer):IHaupt; stdcall;
       public
         constructor Create;
         destructor Destroy; override;
         property Haupts[Index:Integer]:IHaupt read GetIHaupt write SetIHaupt;
     end;


procedure tCustomClass.SetIhaupt(Index:Integer; Value:IHaupt); stdcall;
begin
  if (Index > -1) and (Index < 6) then fapplet[Index] := Value else
    raise exception.CreateFmt('Bad Index %d',[Index]);
end;

function tCustomClass.GetIHaupt(Index:Integer):IHaupt; stdcall;
begin
  result := nil;
  if (index < 0) or (index > 6) then exit
    else result := fApplet[Index];
end;

constructor tCustomClass.create();
begin
  inherited;
  setlength(fApplet, 6);
end;

destructor tCustomClass.destroy;
var i:Integer;
begin
 for i := low(fApplet) to high(fApplet) do
   fApplet[i] := nil;
 inherited;
end;
////////////////////////////////////////////////////////////////////////////////

type tHauptClass = class(tInterfacedObject, IHaupt)
       protected
         procedure MyLoop; stdcall;
       public
     end;

procedure tHauptClass.MyLoop; stdcall;
begin
  showmessage('hui');
end;

////////////////////////////////////////////////////////////////////////////////

procedure TForm1.FormCreate(Sender: TObject);
var i, j : integer;
    IH : IHaupt;
begin
  j := 0;
  with tCustomClass.Create do begin
    for i := 1 to 1000 do begin
      for j := 0 to 5 do begin
        IH := NIL;
        IH := tHauptClass.Create;
        Haupts[j] := IH;
      end;

      for j := 5 downto 0 do begin
        IH := Haupts[j];
        if (ih <> nil) then ih.MyLoop;
        Haupts[j] := NIL;
      end;
    end;
  end;
end;
  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 00:23 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