Re: How to access COM objects' internal data?
A COM object can implement multiple interfaces (but only one
of them can be dual). In your case you can expose a separate
COM interface for internal use and not publish it to outside
clients. You may even opt for no marshaling support if that
makes sense for your internal interface (e.g. use [local] MIDL
attribute on the interface).
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"Boris" <boris@gtemail.net> wrote in message
news:op.tz00ky1s45fww6@burk.mshome.net...
On Thu, 11 Oct 2007 02:31:15 +0300, Igor Tandetnik <itandetnik@mvps.org>
wrote:
[...]
Furthermore users of the library will see functions which are meant
only to be used internally.
I don't understand. If you don't want them publicly available, don't
expose them on a public COM interface. What again seems to be the
problem?
Imagine a workbook in Excel which provides access to the worksheets
collection. If the workbook is loaded it might want to initialize the
worksheets collection (eg. storing the worksheet names in m_coll in the
collection). Now how should this be done ideally? Shall the workbook which
is another interface call functions of the interface worksheets (which are
however not meant to be used by Excel users as they don't initialize
worksheet collections)? Or shall the workbook assume that the interface
worksheets is implemented by a concrete Excel COM class which provides a
Init() function (thus circumventing the interface and accessing the COM
class directly)?
Boris