Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

template<class I>
HRESULT ComPtr< I >::createInprocObject ( const CLSID &  clsid  )  [inline]

Creates an in-process object of the given class ID and starts to manage a reference to the created object in case of success.

Definition at line 352 of file ptr.h.

Referenced by WebServiceSession::authenticate(), ComPtr< IGuest >::createLocalObject(), and main().

    {
        HRESULT rc;
        I *obj = NULL;
#if !defined (VBOX_WITH_XPCOM)
        rc = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, _ATL_IIDOF(I),
                              (void**)&obj);
#else /* !defined (VBOX_WITH_XPCOM) */
        nsCOMPtr<nsIComponentManager> manager;
        rc = NS_GetComponentManager(getter_AddRefs(manager));
        if (SUCCEEDED(rc))
            rc = manager->CreateInstance(clsid, nsnull, NS_GET_IID(I),
                                         (void **) &obj);
#endif /* !defined (VBOX_WITH_XPCOM) */
        *this = obj;
        if (SUCCEEDED(rc))
            obj->Release();
        return rc;
    }


Generated by  Doxygen 1.6.0   Back to index