A
Arathij
Guest
CComPtr<IDispatch> spDispatch;
m_obj->QueryInterface (IID_IDispatch, (void**)&spDispatch); // here spDispatch is always NULL
CLASS
template<class T0, class... T>
struct GetFirstParameterPackType { typedef T0 Value; };
template<class... Interfaces>
class ScriptHostObjectBase : public Interfaces..., public CComObjectRootEx<CComMultiThreadModelNoCS>
{
private:
typedef ScriptHostObjectBase<Interfaces...> Self;
typedef std::function<IDispatch* (Self*)> InterfaceCastFunc;
typedef typename GetFirstParameterPackType<Interfaces...>::Value FirstInterface;
static const int InterfaceCount = sizeof...(Interfaces);
static const GUID InterfaceGuids[InterfaceCount];
static const InterfaceCastFunc CastFuncs[InterfaceCount];
static ITypeInfo* TypeInfoCache[InterfaceCount];
struct Entry
{
UINT interfaceIdx;
DISPID dispid;
};
const DISPID BaseVirtualDispID = 0x40000000;
const DISPID MaxVirtualDispID = 0x50000000;
std::vector<Entry> m_vecDispIDs;
BEGIN_COM_MAP(ScriptHostObjectBase)
COM_INTERFACE_ENTRY2(IDispatch, FirstInterface)
END_COM_MAP()
;;;;;;
}
can you please share any sample / example
Continue reading...
m_obj->QueryInterface (IID_IDispatch, (void**)&spDispatch); // here spDispatch is always NULL
CLASS
template<class T0, class... T>
struct GetFirstParameterPackType { typedef T0 Value; };
template<class... Interfaces>
class ScriptHostObjectBase : public Interfaces..., public CComObjectRootEx<CComMultiThreadModelNoCS>
{
private:
typedef ScriptHostObjectBase<Interfaces...> Self;
typedef std::function<IDispatch* (Self*)> InterfaceCastFunc;
typedef typename GetFirstParameterPackType<Interfaces...>::Value FirstInterface;
static const int InterfaceCount = sizeof...(Interfaces);
static const GUID InterfaceGuids[InterfaceCount];
static const InterfaceCastFunc CastFuncs[InterfaceCount];
static ITypeInfo* TypeInfoCache[InterfaceCount];
struct Entry
{
UINT interfaceIdx;
DISPID dispid;
};
const DISPID BaseVirtualDispID = 0x40000000;
const DISPID MaxVirtualDispID = 0x50000000;
std::vector<Entry> m_vecDispIDs;
BEGIN_COM_MAP(ScriptHostObjectBase)
COM_INTERFACE_ENTRY2(IDispatch, FirstInterface)
END_COM_MAP()
;;;;;;
}
can you please share any sample / example
Continue reading...