Save data to Olevariant

xiaoxiao2021-03-06  72

Function TTautotest.getObj: Olevariant;

VAR T: TDATACLASS;

MS: TMEMORYSTREAM;

Begin

T: = TDATACLASS.CREATE (NIL);

MS: = TMEMORYSTREAM.CREATE

Try

T.SaveTostream (MS);

Result: = VararrayCreate ([0, Ms.Size-1], Varbyte);

Ms.Position: = 0;

Ms.Readbuffer (Vararraylock (Result); ms.size

Finally

T.free;

Ms.free;

Vararrayunlock (Result);

END;

END;

转载请注明原文地址:https://www.9cbs.com/read-109180.html

New Post(0)