Next Previous Contents

6.10 Supporting multiple interfaces

The Haskell COM component design detailed in the last couple of section can easily be extended to support multiple interface per component. For example, supposing the IntRef component also provide a method for drawing its current value via the IDraw interface:

[ object,
  uuid(C1DF9B10-BDDB-11d1-99CC-006097B7314A),
  pointer_default(unique)
]
interface IIntRef {
  HRESULT set([in] int x);
  HRESULT get([out] int* val);
}
[ object,
  uuid(C1DF9B12-BDDB-11d1-99CC-006097B7314A),
  pointer_default(unique)
]
interface IDraw {
  HRESULT Draw([in] HDC hdc);
}

[uuid(116E95C0-075E-11d2-A4E9-00A0C91F393A)]
coclass IntRef {
  [default]interface IIntRef;
  interface IDraw;
}

To accommodate this extra interface, the following changes will have to be made:


Next Previous Contents