ClassInfo function in Delphi 7 -


when define class in delphi 7:

  tperson = class(tobject)   private     flname: string;     ffname: string;     fage: integer;     fbdate: tdate;   public   published     property fname: string read ffname write ffname;     property lname: string read flname write flname;     property age: integer read fage write fage;     property bdate: tdate read fbdate write fbdate;   end;  procedure listcomponentproperties(aobject: tobject; strings: tstrings); var   count, size, i: integer;   list: pproplist;   propinfo: ppropinfo;   propvalue: string; begin   count := getproplist(aobject.classinfo, tkany, list);   size  := count * sizeof(pointer);   getmem(list, size);   try     count := getproplist(aobject.classinfo, tkany, list);     := 0 count - 1     begin       propinfo := list^[i];       propvalue := vartostr(getpropvalue(aobject, propinfo^.name));     end;       freemem(list);   end; end; 

and want list of published properties listcomponentproperties error message displayed.the error related following command , aobject.classinfo:

count := getproplist(aobject.classinfo, tkany, list); 

any appreciated.

you have enable rtti type. default not enabled. declare type this:

type   {$m+}   tperson = class(tobject)   ....   end;   {$m-} 

your initial call getproplist wrong. must read:

count := getproplist(aobject.classinfo, tkany, nil); 

if enabled warnings compiler have told you passing uninitialized variable.

i've not checked more of code. there may more errors.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -