AGB  ·  Datenschutz  ·  Impressum  







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

Tapi Callback Funktion darf nicht in Klasse sein

Ein Thema von Jumpy · begonnen am 26. Nov 2012 · letzter Beitrag vom 27. Nov 2012
 
Benutzerbild von Sir Rufo
Sir Rufo

Registriert seit: 5. Jan 2005
Ort: Stadthagen
9.454 Beiträge
 
Delphi 10 Seattle Enterprise
 
#4

AW: Tapi Callback Funktion darf nicht in Klasse sein

  Alt 26. Nov 2012, 12:15
Delphi-Quellcode:
unit MyTapiObj;

interface

type
  TMyTapiObj = class
  protected
    procedure CalledFromCallBack;
  public
    constructor Create;
    destructor Destroy; override;
  end;

implementation

var
  _TapiInitialized : Boolean;
  _MyTapiObjList : TObjectList;

procedure TapiCallBack;
var
  LIdx : Integer;
begin
  for LIdx := 0 to Pred( _MyTapiObjList ) do
    ( _MyTapiObjList[LIdx] as TMyTapiObj ).CalledFromCallBack;
end;

procedure TapiInitialize;
begin
  if not _TapiInitialized then
  begin

    // Initialization code goes here

    _TapiInitialized := True;
  end;
end;

constructor TMyTapiObj.Create;
begin
  inherited;
  TapiInitialize;
  _MyTapiObjList.Add( Self );
end;

destructor TMyTapiObj.Destroy;
begin
  _MyTapiObjList.Remove( Self );
  inherited;
end;

initialization

  _MyTapiObjList := TObjectList.Create( False );

finalization

  _MyTapiObjList.Free;

end.
Kaum macht man's richtig - schon funktioniert's
Zertifikat: Sir Rufo (Fingerprint: ‎ea 0a 4c 14 0d b6 3a a4 c1 c5 b9 dc 90 9d f0 e9 de 13 da 60)
  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 18:00 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