A
Arathij
Guest
Hi
this is my generic class with templates when I try to query using QueryInterface
here the spDispatch is always NULL this doesn't work in VS2017 with windows server 2016 please help in resolving this , tlb is compiled with MIDL in VS2017 no difference
though this works fine with VS2015 and windows server 2012
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()
;;;;;;
}
Continue reading...
this is my generic class with templates when I try to query using QueryInterface
here the spDispatch is always NULL this doesn't work in VS2017 with windows server 2016 please help in resolving this , tlb is compiled with MIDL in VS2017 no difference
though this works fine with VS2015 and windows server 2012
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()
;;;;;;
}
Continue reading...