What is such a beast, and just how do I create one and use it?
Jerry
Generally you won't need to implement this interface as it is usually
passed by some other COM object for you to use.
Implementing it yourself is not a simple matter, however, Delphi might
have done it for you already.
Note that I have not tried the following.
uses AXCtrls
var
S: TStrings;
OS: IStrings;
EnumString: TStringsEnumerator; { implements IEnumString }
begin
S := TStringList.Create;
try
GetOLEStrings(S, OS);
EnumString := TStringsEnumerator.Create(OS);
{ Use the EnumString Obj as required - you will need to
QueryInterface to get a ref to IEnumString }
finally
EnumString.Free;
S.Free;
end;
end;
If this doesn't work try copying all the code in TStringsEnumerator to
your own strings enumerator object, and change it to inherit from
TInterfacedObject instead of TContainedObject.
Let me know if it works - good luck
> I have need to be able to create and use an IEnumString.
>
> What is such a beast, and just how do I create one and use it?
Sent via Deja.com http://www.deja.com/
Before you buy.
What is such a beast, and just how do I create one and use it?
>>
This is the declaration in the ActiveX unit.
{$EXTERNALSYM IEnumString}
IEnumString = interface(IUnknown)
['{00000101-0000-0000-C000-000000000046}']
function Next(celt: Longint; out elt;
pceltFetched: PLongint): HResult; stdcall;
function Skip(celt: Longint): HResult; stdcall;
function Reset: HResult; stdcall;
function Clone(out enm: IEnumString): HResult; stdcall;
end;
It's one of a group of IEnum interfaces, which are basically
the COM way of passing collections as parameters - the
Next function returns S_OK while the sender has more
items in the collection to send, S_False if it doesn't.
Have a look at the TStringsEnumerator class in AxCtrls.pas
which implements this interface.
Deborah Pate