0

I need to work with IStorage and IStream interfaces in Delphi 7. I need the name list of storages and streams in IStorage instances. 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

How can I check the record type without any compiler error message?

4

1 回答 1

1

好的。MSDN 文档(针对 Delphi 用户)具有误导性。此字段STATSTG在 ActiveX 单元中按名称定义dwType。当我使用它时,它当然会编译。

于 2017-06-14T11:38:35.867 回答