.NET 相当于 Delphi IStream 初始化
我有以下 Delphi 代码:
var
Stream: TMemoryStream;
StreamI: TStreamAdapter;
OleStream: IStream;
begin
Stream:= TMemoryStream.Create;
Stream.LoadFromFile(filename);
StreamI:= TStreamAdapter.Create(Stream, soOwned);
VSPDFViewer1.LoadStream(StreamI as IStream, '');
end;
它实际上将 IStream 对象传递给 COM 组件。 .NET 有“System.Runtime.InteropServices.ComTypes.IStream”接口,但我无法找到使用它的正确方法。如何使用数据初始化 IStream 并将其传递给 .NET 中的 COM 对象?
I have the following Delphi code:
var
Stream: TMemoryStream;
StreamI: TStreamAdapter;
OleStream: IStream;
begin
Stream:= TMemoryStream.Create;
Stream.LoadFromFile(filename);
StreamI:= TStreamAdapter.Create(Stream, soOwned);
VSPDFViewer1.LoadStream(StreamI as IStream, '');
end;
Which actually passes an IStream object to a COM component.
.NET has the "System.Runtime.InteropServices.ComTypes.IStream" interface, but I can't figure out a proper way to use it. How to initialize IStream with data and pass it to COM object in .NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有点糟糕,但您必须编写自己的 .NET
StreamAdapter
类。幸运的是,您可以从 Microsoft 窃取所有代码:It kind of sucks, but you're going to have to write your own .NET
StreamAdapter
class. Fortunately you can steal all the code from Microsoft: