Halaman

Minggu, 26 Juni 2011

Delphi : Tips on Retrieving/Storing Pointer/Objects/Clasess to/from a variant

Hello there! this really is a lovely day isn't it? :)
I come accross another great tips for you using variants object types and also how to use them with pointers and objects
for a little note, objects are classes, and objects and classes ARE pointers
  1. Storing pointers objects / classes / pointers to a variant
    1. cast the objects / classes / pointers to a native int : NativeInt(aPointer);
    2. store the NativeInt to the variant variable
  2. Retrieve stored pointers / objects / classes from a variant
    1. preapare a NativeInt variabele, and assign the variant containing objects / classes / pointers to the NativeInt variable
    2. cast the NativeInt variable to the pointer type, classes that you need TObject(the_NativeInt_variable).className;
Voila! another neat trick which will do the rest :) God bless you everyone!

Tidak ada komentar:

Posting Komentar