14
votes
Vote UpVote

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 ...
Favorite? Off-Topic? Rodrigo @ 2011-11-04 07:19

Statistics

Visits: 761
Votes: 14
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Barton_Stano
Chris Rolliston
Fran├žois
GunSmoker
Jeroen Pluimers
Lars Fosdal
Martijn Coppoolse
Primoz Gabrijelcic
Stefan Glienke
Tier777
TOndrej
vcldeveloper
Yogi Yang
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)