I am creating an ATL type library with a class type of factory. Something like that:
[ object, uuid(...), ... ]
interface INumber : IDispatch {
[propget, id(0)] HRESULT Value([out, retval] LONG* pVal);
}
[ object, uuid(...), ... ]
interface INumberFactory : IDispatch {
[id(1)] HRESULT GetNumber([in] BSTR numberName, [out, retval] INumber* pVal);
}
[ uuid(...) ]
coclass NumberFactory {
[default] interface INumberFactory;
}
Then the user can get an instance of the class that implements the interface INumberthrough NumberFactory.
This works well, but I cannot figure out how to define and instantiate the ATL objects returned by the method NumberFactory.GetNumber(). If I define numbers in IDL like this:
[ uuid(...) ]
coclass One {
[default] interface INumber;
}
The component Onecan be created by the user. But I would like to restrict it, so the only way to get an instance of the class Oneis to call NumberFactory.GetNumber("One").
, : IDL, One, One NumberFactory coclass INumber One ?
, - , ATL , ?