http://www.codeguru.com/activex/MiniDcom.html

解决方案 »

  1.   

    伪代码://进程内com
    #include <windows.h>
    #include <tchar.h>  //  for Unicode to ANSI
    #include <iostream.h>
    #include <initguid.h>#include "..\Server\ITest.h"// this is the com pathint main(int argc,char **argv)
    {
        if(FAILED(CoInitialize(NULL))
         return -1;
        
         IClassFactory *pCF;
         IUnknown *pUnk;
         HRESULT hr = pCF->CreateInstance(NULL,CLSID(u),(void **)&pUnk);
         
         // CALL QUERYINTERFACE TO FIND WHAT YOU WANT 
         IMethod *pMethod;
         hr = pUnk->QueryInterface(CLSID,(void **)&pMethod);
         pMethod->Method();
         pCF->Release();
         .......
         CoUninitialize();
    }
      

  2.   

    少了一个:
    IClassFactory *pCF;
    hr = CoGetClassObject(clsid,CLSCTX_SERVER,NULL,IDD_IClassFacory,
                          (void **)&pCF);
    然后在调用 pCF->good luck for you !