DCOM Samples

C++

void ConnectComputer(BSTR computer)
{
    ITcEventLogPtr spTcEventLog
    COSERVERINFO comServerInfo={0};

    comServerInfo.pwszName = computer;
    MULTI_QI mQI={&IID_ITcEventLog, NULL,0};

    hr=::CoCreateInstanceEx( CLSID_TcEventLog,
                           NULL,
                           CLSCTX_SERVER,
                           &comServerInfo,
                           1,
                           &mQI);
    if ( SUCCEEDED(hr) )
    {
        spTcEventLog =mQI.pItf;
        mQI.pItf->Release();
    }

    //...
}