I created a small automation object with following IDL (part of it):

   interface ItestAX: IDispatch
  {
    [
    propget,
    id(0x00000001)
    ]
    HRESULT _stdcall Devices([out, retval] IDevices ** Value );
  };

   interface IIDevices: IDispatch
  {
    [
    propget,
    id(0x00000000)
    ]
    HRESULT _stdcall Device([in] long Idx, [out, retval] IDevice ** Value );
    [
    propget,
    id(0x00000002)
    ]
    HRESULT _stdcall Count([out, retval] long * Value );
  };

   interface IIDevice: IDispatch
  {
    [
    propget,
    id(0x00000001)
    ]
    HRESULT _stdcall Name([out, retval] BSTR * Value );
  };

This matches pretty much the interface you described earlier. Note the
id(0x00000000) which makes Device the default member of IIDevices. This is
the same as id(DISPID_VALUE) in your case.

Now, the following lines do work for me to get the Name member of IIDevice
(ActX,a,b:variant;s:string):

  ActX:=CreateOleObject(MyTestControl);
  a:=ActX.Devices;
  b:=a.Device[3];
  s:=b.Name;
  b:=ActX.Devices.Device[3];
  s:=b.Name;
  b:=ActX.Devices[3];
  s:=b.Name;
 
Note that the default member does work correctly:
Devices.Device[3]===Devices[3].

I'm using fpc 2.5.1 svn 17599.   

Ludo

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to