Re: CoCreateInstance inside a COM dll?
Donos <donguy76@gmail.com> wrote:
Ok here i am going to get a interface pointer using the following
function, This is inside the COM.
STDMETHOD GetMyInterface(IMyInterface** pMyInterface, VARIANT_BOOL*
pResult)
{
-------------------------
QueryInterface(__uuidof(IMyInterface), (void **)&pMyInterface);
Drop the ampersand. pMyInterface is already a pointer to a pointer, you
should not take its address.
Also, I don't see you set *pResult to anything, nor return any HRESULT.
Now inside Client app, i add the code as,
GetInterface()
{
IMyInterface** pInterface;
HRESULT hr = m_pFirstInterface->GetMyInterface(&pInterface,
(VARIANT_BOOL*)&rc);
}
GetMyInterface takes IMyInterface**. You are passing IMyInterface***.
Where is rc declared?
In any case, I don't see the point of the exercise. Why do you need
GetMyInterface method? Why can't the client simply do
IMyInterface* pInterface = 0;
HRESULT hr = m_pFirstInterface->QueryInterface(__uuidof(IMyInterface),
(void**)&pInterface);
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925