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?
OK. The MSDN documentation (for Delphi users) is misleading. This field of STATSTG
is defined in the ActiveX unit by name dwType
. When I use it, it compiles, of course.