14
votes
Implementing a Delphi for..in loop on COM collections and Variant Arrays
The Road to Delphi
– Enumerating a collection of Variants Many times when you are working with COM objects you need iterate over a collection, and usually the way to do this is using the _NewEnum function (which return a IUnknown interface) implemented by the COM class and then assign that value to a IEnumVariant variable. something like this var Enum : IEnumVariant; iValue : LongWord; begin oEnum := IUnknown(ACollection._NewEnum) as IEnumVariant; while oEnum.Next(1, AItem, iValue) = S_OK do begin //do something end; This not look very complicated, but when do you have to work with many ...
Statistics
|
Visits by Source |
User Actions |



