How to create a remote object?

In vb,I can use createobject("xx","remotehost") to create a remote object,bue in vc,how implement it ?
shalaAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
It's quite similar in VC, use

    HRESULT         sc;
    COSERVERINFO    csi;
    MULTI_QI        mqi;

    ZeroMemory  (   &csi,   sizeof  (   COSERVERINFO));
    ZeroMemory  (   &mqi,   sizeof  (   MULTI_QI));

    csi.pwszName    =   L"\\\\remote_server";
    mqi.pIID        =   &IID_IMyInterface;
   
    sc  =   ::CoCreateInstanceEx(   CLSID_MyCLSID,  
                                    NULL,
                                    CLSCTX_REMOTE_SERVER,
                                    &csi,
                                    1,
                                    &mqi
                                );


Feel free to ask if you need more information!
0
 
shalaAuthor Commented:
This answer is a good suggest!
0
All Courses

From novice to tech pro — start learning today.