Board index » delphi » IVariantCollection - Is it TRUE Collection???

IVariantCollection - Is it TRUE Collection???

Hi I try to implement Collection on my DCOM.
It is OK on DELPHI and MS BASIC 6 - worket!

My code Interface code is:
====
IGALON = interface(IDispatch)
  [ uuid '{7E711108-74A6-11D3-A94B-006052053FB8}',
    version 1.0,
    helpstring 'Dispatch interface for GALON',
    dual,
    oleautomation ]
  function Count: Integer [propget, dispid $00000001]; safecall;
  function Items(Index: Integer): IRecipient [propget, dispid $00000000,
defaultcollelem]; safecall;
  function _NewEnum: IUnknown [propget, dispid $FFFFFFFC]; safecall;
end;

====

But, but on IIS4 with ASP  (VB script), when I try this

<%
For Each Item in Object.Items
    response.write Item.Name +"</br>"
Next

If Err.Number <> 0 Then
response.write(Err.Number & " " & Err.Description)
End If
%>

I receive
err.Number = 451
and
Err.Description = Object not a collection

What I can do???

Ivan Kojuharov
Ikojuha...@bitex.com

 

Re:IVariantCollection - Is it TRUE Collection???


If you are using the IVariantCollection mechanism from my ComLib.pas file,
your VBA client should be:

For Each Item in Object  'not Object.Items
    response.write Item.Name +"</br>"
Next

Remember, your Items property is a function which returns IRecipient - it is
not the enumerator itself. If you want to implement the enumeration in the
Items property, then create an IItems class implement IVariantCollection in
there, not in the IGALON class

If you look at the Object Hierarchy tutorial on my pages, you'll see how to
do this kind of thing.

have fun
--
Binh Ly
Visit my COM Notes at http://www.castle.net/~bly/com

Ivan Borissov Kojuharov <ikojuha...@bitex.com> wrote in message
news:7tiljj$pis6@forums.borland.com...

Quote
> Hi I try to implement Collection on my DCOM.
> It is OK on DELPHI and MS BASIC 6 - worket!

> My code Interface code is:
> ====
> IGALON = interface(IDispatch)
>   [ uuid '{7E711108-74A6-11D3-A94B-006052053FB8}',
>     version 1.0,
>     helpstring 'Dispatch interface for GALON',
>     dual,
>     oleautomation ]
>   function Count: Integer [propget, dispid $00000001]; safecall;
>   function Items(Index: Integer): IRecipient [propget, dispid $00000000,
> defaultcollelem]; safecall;
>   function _NewEnum: IUnknown [propget, dispid $FFFFFFFC]; safecall;
> end;

> ====

> But, but on IIS4 with ASP  (VB script), when I try this

> <%
> For Each Item in Object.Items
>     response.write Item.Name +"</br>"
> Next

> If Err.Number <> 0 Then
> response.write(Err.Number & " " & Err.Description)
> End If
> %>

> I receive
> err.Number = 451
> and
> Err.Description = Object not a collection

> What I can do???

> Ivan Kojuharov
> Ikojuha...@bitex.com

Re:IVariantCollection - Is it TRUE Collection???


There is some code on bly's web site that shows how to create collections
that can use the VB for each construct.

http://www.intac.com/~bly/com/

Rgds Tim.

Quote
> For Each Item in Object.Items
>     response.write Item.Name +"</br>"
> Next

Re:IVariantCollection - Is it TRUE Collection???


Thanks, and sorry for my mistake.
My error!!!
Ivan

Quote
Binh Ly <b...@castle.net> wrote in message

news:7tjlpe$2mh23@forums.borland.com...
| If you are using the IVariantCollection mechanism from my ComLib.pas file,
| your VBA client should be:
|
| For Each Item in Object  'not Object.Items
|     response.write Item.Name +"</br>"
| Next
|
| Remember, your Items property is a function which returns IRecipient - it
is
| not the enumerator itself. If you want to implement the enumeration in the
| Items property, then create an IItems class implement IVariantCollection
in
| there, not in the IGALON class
|
| If you look at the Object Hierarchy tutorial on my pages, you'll see how
to
| do this kind of thing.
|
| have fun
| --
| Binh Ly
| Visit my COM Notes at http://www.castle.net/~bly/com
|
|
| Ivan Borissov Kojuharov <ikojuha...@bitex.com> wrote in message
| news:7tiljj$pis6@forums.borland.com...
| > Hi I try to implement Collection on my DCOM.
| > It is OK on DELPHI and MS BASIC 6 - worket!
| >
| > My code Interface code is:
| > ====
| > IGALON = interface(IDispatch)
| >   [ uuid '{7E711108-74A6-11D3-A94B-006052053FB8}',
| >     version 1.0,
| >     helpstring 'Dispatch interface for GALON',
| >     dual,
| >     oleautomation ]
| >   function Count: Integer [propget, dispid $00000001]; safecall;
| >   function Items(Index: Integer): IRecipient [propget, dispid $00000000,
| > defaultcollelem]; safecall;
| >   function _NewEnum: IUnknown [propget, dispid $FFFFFFFC]; safecall;
| > end;
| >
| > ====
| >
| > But, but on IIS4 with ASP  (VB script), when I try this
| >
| > <%
| > For Each Item in Object.Items
| >     response.write Item.Name +"</br>"
| > Next
| >
| > If Err.Number <> 0 Then
| > response.write(Err.Number & " " & Err.Description)
| > End If
| > %>
| >
| > I receive
| > err.Number = 451
| > and
| > Err.Description = Object not a collection
| >
| > What I can do???
| >
| > Ivan Kojuharov
| > Ikojuha...@bitex.com
| >
| >
| >
| >
|
|

Other Threads