OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Hugh Brown (hbrownASKARI.COM)
Date: Mon Jul 23 2001 - 16:15:11 CDT

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

    I've had to set up a new interface pointer with initial values (particularly
    where the object being created has a parent-child type relationship), but I
    don't recall ever using a dynamic cast. A typical piece of code looks like
    this:

    HRESULT RiskWorldDB::AddConnection(LPCSTR dsn, LPCSTR user, LPCSTR password,
            IDispatch ** pRiskWorldConnection)
    {
            CComObject<RiskWorldConnection> *con = NULL;
            HRESULT hr = CComObject<RiskWorldConnection>::CreateInstance(&con);

            if (SUCCEEDED(hr))
            {
                    hr = con->QueryInterface (IID_IDispatch, reinterpret_cast<void
    **>(pRiskWorldConnection));
                    if (FAILED(hr))
                            delete con;
                    else
                    {
                            con->Init(this);
                            con->m_dsn = dsn;
                            con->m_user = user;
                            con->m_password = password;
                            m_connections.push_back(con);
                    }
            }
            return hr;
    }

    Does that help?

    Hugh
    http://www.iwebthereforeiam.com/TaborMap.asp
    The largest collection of Tim Tabor resource links in the charted universe

    -----Original Message-----
    From: Distributed COM-Based Code [mailto:DCOMDISCUSS.MICROSOFT.COM]On
    Behalf Of Ben Callister
    Sent: Monday, July 23, 2001 4:58 PM
    To: DCOMDISCUSS.MICROSOFT.COM
    Subject: Question: No RTTI Data when registering VC COM component under
    CO M+...

    Hi All:

    i have a COM component created with VC++. this component contains the
    TSession COM class. this class has a method as part of the *C++* structure
    of the class (not part of the COM interface) - TSession::SetName(string
    sName). whenever i CoCreateInstance() on this class from inside C++, i
    perform a dynamic_cast<TSession*>(pSession) to get to the C++ portion of the
    class structure so that i can call the SetName() method before handing the
    actual ITSession interface pointer back to the client. this is for
    initialization purposes. this works fine and the component runs great when
    it is registered normally via the system registry. however, when i register
    this component under COM+ via the catalog, the component throws an exception
    when i perform the actual dynamic_cast call. the error i get is:

    'Access Violation - No RTTI Data!'
     -2147467259 (80004005)

    i have 'Enable RTTI...' turned ON in the project settings. does anyone know
    why i am having this problem? and why this occurs only when registered under
    COM+? any answers, comments, suggestions, etc are greatly appreciated.

    thanks,

    Benjamin Callister
    Vice President of Engineering
    Tutor.com
    Real Tutors. Real Results.

    e: bcallistertutor.com
    p: 212.528.3101; x.227
    w: http://www.tutor.com <http://www.tutor.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