OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Amar (Amarjeet.singhKLA-TENCOR.COM)
Date: Thu Mar 07 2002 - 05:50:48 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    Hi Phil,
    Thanks it's working now.
    This is what i learnt and forgot while implementing the same.
    Why is it happen some time that we do know and forgot some time?
    Is it called intelligence?
    Amar.
    Thanks .

    -----Original Message-----
    From: Distributed COM-Based Code [mailto:DCOMDISCUSS.MICROSOFT.COM]On
    Behalf Of Phil Reynolds
    Sent: Thursday, March 07, 2002 4:03 PM
    To: DCOMDISCUSS.MICROSOFT.COM
    Subject: Re: Thread hangs when It tries to Call GetInterfaceFromGlo bal

    The thread that put the object in the table must pump messages.

    ---------------------------------------------------------
    Phil Reynolds
    Ridgeway Systems and Software
    Tel: +44 118 938 1211
    Fax: +44 118 935 4444
    mailto:preynoldsridgewaysystems.com
    http://www.ridgewaysystems.com

    > -----Original Message-----
    > From: Amar [mailto:Amarjeet.singhKLA-TENCOR.COM]
    > Sent: 07 March 2002 10:35
    > To: DCOMDISCUSS.MICROSOFT.COM
    > Subject: [DCOM] Thread hangs when It tries to Call
    > GetInterfaceFromGlobal
    >
    >
    > Hi All
    > When I try to get back interface pointer from global table in
    > another thread
    > the threads hangs.
    > This is the main thread which registers interface in global table:
    >
    > MainThread{
    > DWORD* pdwCookie= new DWORD;
    > // Test
    > MSXML2::IXMLDOMDocumentPtr spTest(__uuidof(MSXML2::DOMDocument40));
    > hrResult = ::CoCreateInstance (CLSID_StdGlobalInterfaceTable,NULL,
    > CLSCTX_INPROC_SERVER,IID_IGlobalInterfaceTable,(void**)&m_pGlobal);
    > hrResult = m_pGlobal->RegisterInterfaceInGlobal
    > (spTest,__uuidof(MSXML2::DOMDocument40), pdwCookie);
    > dw = *pdwCookie;
    > phEightThreads[iEightThreads - 1] =
    > ::CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)
    > ExcelThreadProcSendJob,(LPVOID )pdwCookie,0,0);
    > pIter++;
    > }
    > ::WaitForMultipleObjects (8,
    > phEightThreads,true,INFINITE);
    >
    > }
    >
    > Following is the thread proc that try to recieve interface
    > pointer from
    > global.
    > and at the point it calls API GetInterfaceFromGlobal the API hangs.
    >
    >
    > int CAppThread::ExcelThreadProcSendJob(LPVOID pParam)
    > {
    > ::CoInitialize (0);
    > //i++;
    >
    > // ::MessageBox (0,_bstr_t(long(i)),_bstr_t("Thread No:"),0);
    >
    > try
    > {
    > {
    >
    > IUnknown* pUnk = 0;
    > IRFT* pRFT = 0;
    > //IRFT* ptr = 0;
    > Transfer *pTransfer = (Transfer*)pParam;
    > //DWORD* pDW = (DWORD*)pParam;
    > //IStream* pStream = (IStream*)pParam;
    > //_ConnectionPtr spPtr;
    > MSXML2::IXMLDOMDocumentPtr spTest;
    > //(__uuidof(MSXML2::DOMDocument40));
    > //spTest.CreateInstance (__uuidof(MSXML2::DOMDocument40));
    > //HRESULT hr =
    > m_pGlobal->GetInterfaceFromGlobal((pTransfer->Cookie),__uuidof
    > (IRFT),(void**
    > )&pRFT);
    > HRESULT hr =
    > m_pGlobal->GetInterfaceFromGlobal(dw,__uuidof(MSXML2::IXMLDOMD
    > ocumentPtr),(v
    > oid**)&spTest);
    > //Unmarshall Application Pointer
    > //HRESULT hr =
    > CoGetInterfaceAndReleaseStream((pStream),__uuidof(IUnknown),(LPVOID
    > *)&pUnk);
    > ::MessageBox (0,_bstr_t(long(0)),_bstr_t("Inside
    > SendJob Thread-Check"),0);
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM