PRB: Using MFC OLE Components with Transaction Server

Last reviewed: March 21, 1997
Article ID: Q165605
The information in this article applies to:
  • Microsoft Transaction Server, version 1.0
  • The Microsoft Foundation Classes included with Microsoft Visual C++ 32-Bit Editions, versions 4.2, 5.0

SYMPTOMS

When registering and viewing a Microsoft Foundation Class (MFC) OLE component with the Microsoft Transaction Server Explorer, the following warning appears:

   Some of the objects properties were missing or damaged.
   This can occur if the registry entries associated with the item
   are changed by some other program.
   Damaged items must be deleted and re-created.

CAUSE

MFC inproc servers do not register their interfaces in the interface section of the registry. When they are configured to run in a Microsoft Transaction Server package, the interfaces must be registered so that COM can marshal the interfaces or use OLEAUT32. Because the information is not in the registry, you receive an E_NOINTERFACE error, 80004002.

RESOLUTION

To resolve this problem, register the interfaces. See the revised DllRegisterServer code in the MORE INFORMATION section of this article.

STATUS

Microsoft has confirmed this to be a problem in Transaction Server version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following code is a revised DllRegisterServer from an MFC server that should register the interface of an automation object. The interface is registered by the call to RegisterTypeLib, as long as the interface is described by the type library.

Sample Code

   STDAPI DllRegisterServer(void)
   {
       USES_CONVERSION;
       AFX_MANAGE_STATE(AfxGetStaticModuleState());
       COleObjectFactory::UpdateRegistryAll();

       ITypeLib *pTLB;
       OLECHAR *pModuleName;
       HRESULT hr = S_FALSE;
       TCHAR fileName[MAX_PATH];
       if(!GetModuleFileName(AfxGetApp()->m_hInstance, fileName,MAX_PATH))
           return hr;
       pModuleName = T2OLE(fileName);
       hr=LoadTypeLib(pModuleName,&pTLB);
       if(FAILED(hr))
           return hr;

       hr=RegisterTypeLib(pTLB,pModuleName,NULL);
       pTLB->Release();

       return hr;
   }

REFERENCES

ARTICLE-ID: Q154664

TITLE     : Dispatch Interface for Automation Object Must Be Registered


Additional query words: CCmdTarget
Keywords : kbprg TSrvGen
Technology : OLE
Version : 1.0 4.2 5.0
Platform : WINDOWS
Issue type : kbprb
Resolution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.