Board index » delphi » Variant and OLE Automation empty object

Variant and OLE Automation empty object

Hi all,

Here is my concern :

I have an OLE Automation server and I try to call it.

The trouble is some objects (variant in Delphi) have empty collections. In
Delphi, if I evaluate the address of the empty collection, I found
$00000000. How can I test this value ?

I've tried :
        if (OLEObj = Nil)       -> EVariantError
        if (OLEObj = varEmpty)  -> EVariantError
        if (OLEObj)             -> EVariantError

Thanks in advance.

Jr?me Lyperre
E-Mail : jerome.lype...@cognos.com

 

Re:Variant and OLE Automation empty object


You didn't say if the OLE Automation server was one you wrote or
someone else's.  I'll assume it's yours, so you can change it.
If an OLE object is supposed to represent a collection, then it
would be very helpful it the object implemented a Count and
indexed Items property so that you could just iterate over the
collection's "subobjects" via a simple -for- loop.

If it's not your OLE server, and the collection object doesn't
implement a Count and indexed Items property, then it should
at least give you access to an enumeration object so you
can manually iterate over the collection with the usual Reset,
Next, and Skip methods.

John

Quote
"Jr?me Lyperre" <jerome.lype...@cognos.com> wrote:
>Hi all,
>Here is my concern :
>I have an OLE Automation server and I try to call it.
>The trouble is some objects (variant in Delphi) have empty collections. In
>Delphi, if I evaluate the address of the empty collection, I found
>$00000000. How can I test this value ?
>I've tried :
>    if (OLEObj = Nil)       -> EVariantError
>    if (OLEObj = varEmpty)  -> EVariantError
>    if (OLEObj)             -> EVariantError
>Thanks in advance.
>Jr?me Lyperre
>E-Mail : jerome.lype...@cognos.com

Other Threads