I see that MS provides two sets of COM wrappers. One comes packaged with
nice language extensions #import "..." _com_ptr_t, _bstr_t & _varaint_t.
Another one is coming with ATL CComPtr, CComVariant, etc. ATL also is nice
and accompanied with several wizards (with several bugs). I found that
these COM's wrappers are colliding at least in my case. I am working with
MSXML.
When I use #import I getting proxy signature for XMLDocument.async like
put_asunc(short ....)
when I use #include <msxml2.h> I get proxy signature like:
put_asunc(VARIANT ....) ; The question is:
How will be proxy code generated?
I believe MIDL in both cases will generate code based on msxml2.IDL and IDL
uses VARIANTs.
Where #import"" gets information about real data-tpyes for parameters?
What are MS guide lines for using #import and ATL?
-SKV
You can use #import can optionally include one or more attributes. These
attributes tell the compiler to modify the contents of the type-library
headers.
CComPtr Class provider a smart pointer class for managing COM interface
pointers.
If you don't use ATL, you can use C++ com wrapper class, _com_ptr_t object
encapsulates a COM interface pointer and is called a "smart" pointer.
A smart pointer is usually referenced by the typedef definition provided by
the _COM_SMARTPTR_TYPEDEF macro. This macro takes an interface name and the
IID and declares a specialization of _com_ptr_t with the name of the
interface plus a suffix of Ptr. For example:
_COM_SMARTPTR_TYPEDEF(IMyInterface | __uuidof(IMyInterface));
declares the _com_ptr_t specialization IMyInterfacePtr.
Best Regards
Jian Shen
This posting is provided "AS IS" with no warranties, and confers no rights.