如何为来自 TStream 的 Olevariant 变量赋值?
我需要从 Stream 中读取数据并将读取的缓冲区放入 OleVariant (VarArray) 变量中。
var
MemoryStream : TMemoryStream;
Data : OleVariant;
begin
MemoryStream:=TMemoryStream.Create;
try
FuncFill(MemoryStream); //Filling the stream
MemoryStream.Seek(0,0);
MemoryStream.Read(Data, MemoryStream.Size);//this line lock the app, I need allocate the memory for the OleVariant variable?
finally
MemoryStream.Free;
end;
end;
如何将 TMemoryStream
中的读取值分配给 olevariant
变量?
我正在使用德尔福5。
I need to read from a Stream and put the buffer that was read in a OleVariant
(VarArray) variable.
var
MemoryStream : TMemoryStream;
Data : OleVariant;
begin
MemoryStream:=TMemoryStream.Create;
try
FuncFill(MemoryStream); //Filling the stream
MemoryStream.Seek(0,0);
MemoryStream.Read(Data, MemoryStream.Size);//this line lock the app, I need allocate the memory for the OleVariant variable?
finally
MemoryStream.Free;
end;
end;
How I can assign the read value from the TMemoryStream
to a olevariant
variable?
I'm using delphi 5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
VarArrayLock
函数获取指针到 OleVariant 数据,然后读取到该指针。检查此代码,它使用
varByte
元素的VarArray
。You can use the
VarArrayLock
function to get a pointer to the OleVariant data and then read to this pointer.check this code wich use a
VarArray
ofvarByte
elements.