Partager via


COleObjectFactory::COleObjectFactory

Constructs a COleObjectFactory object, initializes it as an unregistered object factory, and adds it to the list of factories.

COleObjectFactory( 
   REFCLSID clsid, 
   CRuntimeClass* pRuntimeClass, 
   BOOL bMultiInstance, 
   LPCTSTR lpszProgID  
); 
COleObjectFactory( 
   REFCLSID clsid, 
   CRuntimeClass* pRuntimeClass, 
   BOOL bMultiInstance, 
   int nFlags, 
   LPCTSTR lpszProgID  
);

Parameters

  • clsid
    Reference to the OLE class ID this object factory represents.

  • pRuntimeClass
    Pointer to the run-time class of the C++ objects this factory can create.

  • bMultiInstance
    Indicates whether a single instance of the application can support multiple instantiations. If TRUE, multiple instances of the application are launched for each request to create an object.

  • nFlags
    Contains one or more of the following flags:

    • **afxRegDefault   **Sets the threading model to ThreadingModel=Apartment.

    • **afxRegInsertable   **Allows the control to appear in the Insert Object dialog box for OLE objects.

    • afxRegApartmentThreading   Sets the threading model in the registry to ThreadingModel=Apartment.

    • **afxRegFreeThreading   **Sets the threading model in the registry to ThreadingModel=Free.

      You can combine the two flags afxRegApartmentThreading and afxRegFreeThreading to set ThreadingModel=Both. See InprocServer32 in the Windows SDK for more information on threading model registration.

  • lpszProgID
    Pointer to a string containing a verbal program identifier, such as "Microsoft Excel."

Remarks

To use the object, however, you must register it.

For more information, see CLSID Key in the Windows SDK.

Requirements

Header: afxdisp.h

See Also

Reference

COleObjectFactory Class

Hierarchy Chart

CRuntimeClass Structure