Thema: Delphi ClassInfo = nil ? o.O

Einzelnen Beitrag anzeigen

Elvis

Registriert seit: 25. Nov 2005
Ort: München
1.909 Beiträge
 
Delphi 2010 Professional
 
#2

Re: ClassInfo = nil ? o.O

  Alt 31. Aug 2006, 19:27
Ich habe gerade kein Delphi hier, aber mit der Unit hole ich mir normalerweise MetaClasses/VMT.

Delphi-Quellcode:
unit uRttiHelpers;

interface

type
  PClass = ^TClass;
  PSafeCallException = function(self : TObject;
                                exceptObject : TObject;
                                exceptAddr : Pointer) : HResult;
 
  PAfterConstruction = procedure(self : TObject);
  PBeforeDestruction = procedure(self : TObject);
  PDispatch = procedure(self : TObject; var message);
  PDefaultHandler = procedure(self : TObject; var message);
  PNewInstance = function(self : TClass) : TObject;
  PFreeInstance = procedure(self : TObject);
  PDestroy = procedure(self : TObject; outerMost : Shortint);

  PVmt = ^TVmt;
  TVmt = packed record
    SelfPtr : TClass;
    IntfTable : Pointer;
    AutoTable : Pointer;
    InitTable : Pointer;
    TypeInfo : Pointer;
    FieldTable : Pointer;
    MethodTable : Pointer;
    DynamicTable : Pointer;
    ClassName : PShortString;
    InstanceSize : PLongint;
    Parent : PClass;
    SafeCallException : PSafeCallException;
    AfterConstruction : PAfterConstruction;
    BeforeDestruction : PBeforeDestruction;
    Dispatch : PDispatch;
    DefaultHandler : PDefaultHandler;
    NewInstance : PNewInstance;
    FreeInstance : PFreeInstance;
    Destroy : PDestroy;
  end;

function GetVmt(classReference : TClass) : PVmt;

implementation

function GetVmt(classReference : TClass) : PVmt;
begin
  Result := PVmt(classReference);
  Dec(Result);
end;

end.
Oki, hab's gerade wieder installiert ( wurde auch Zeit ) und wie ich es mir dachte gates.
edit: lol, mein Copy and Waste Knopf muss wohl kaputt sein
Miniaturansicht angehängter Grafiken
tobject.classname_211.png  
Robert Giesecke
I’m a great believer in “Occam’s Razor,” the principle which says:
“If you say something complicated, I’ll slit your throat.”
  Mit Zitat antworten Zitat