I've implimented a ATL single thread apartment based project .
class ATL_NO_VTABLE CMySrv :
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<cmysrv,&clsid_mysrv>,
public IMySrv
In the method, I'm creating multiple worker threads and accessing the interface pointer from one context to another with using COM Interface "IGlobalInterfaceTable"
In the main thread registered the interface
void CMySrv::save()
{
CComQIPtr<imysrv> pMySrv(GetUnknown());
CComPtr<iglobalinterfacetable> l_git;
l_git.CoCreateInstance( CLSID_StdGlobalInterfaceTable );
l_git->RegisterInterfaceInGlobal(pMySrv, __uuidof(IMySrv), &dwCookie );
for(int i=0;i<9;i++)
_beginthreadex( 0,0,&(CParllelThreadOperations::ThreadFunc),LPVOID(&dwCookie), 0, &dwThId);
}
In the worker thread I'm passing the cookie information and would get the interface
CComPtr<iglobalinterfacetable> git;
CComPtr<imysrv> pMySrv;
HRESULT hr= 0;
if(git.CoCreateInstance( CLSID_StdGlobalInterfaceTable)>=0)
hr= git->GetInterfaceFromGlobal( dwCookie, __uuidof(IMySrv), (void**)&pMySrv);
But "GetInterfaceFromGlobal" returning "0x8000ffff" error code(it is happening rarely )
Could you please help me on this.
What I have tried:
I don't have much knowledge on GIT interface and read the other articles
The Mechanics of COM+ | Mechanics | InformIT[
^]