[英]How can I check the type of the enumerated IStorage element in Delphi?
I need to work with IStorage
and IStream
interfaces in Delphi 7. I need the name list of storages and streams in IStorage instances. 我需要在Delphi 7中使用IStorage
和IStream
接口。我需要IStorage实例中的存储和流的名称列表。 If I try to collect them like this: 如果我尝试这样收集它们:
procedure TStorageUtility.collectElementNamesByType( iStg_ : IStorage; names_ : TStringList; type_ : byte );
var
enum : IEnumSTATSTG;
rec : StatStg;
num : integer;
begin
if ( iStg_.enumElements( 0, NIL, 0, enum ) = S_OK ) then
while ( enum.next( 1, rec, @num ) = S_OK ) do
begin
if ( rec.type = type_ ) then
names_.add( wideString( rec.pwcsName ) );
end;
end;
I get a compiler error: 我收到编译器错误:
Identifier expected but 'TYPE' found
at the line 在行
if ( rec.type = type_ ) then
Here is the STATSTG record definition : https://msdn.microsoft.com/en-us/library/windows/desktop/aa380319(v=vs.85).aspx 这是STATSTG记录定义: https ://msdn.microsoft.com/zh-cn/library/windows/desktop/aa380319(v = vs.85).aspx
How can I check the record type without any compiler error message? 如何在没有任何编译器错误消息的情况下检查记录类型?
OK. 好。 The MSDN documentation (for Delphi users) is misleading. MSDN文档(针对Delphi用户)具有误导性。 This field of STATSTG
is defined in the ActiveX unit by name dwType
. STATSTG
此字段在ActiveX单元中通过名称dwType
。 When I use it, it compiles, of course. 当我使用它时,它当然会编译。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.