Plus: 这个接口的具体作用是什么,什么时候必须用到?

解决方案 »

  1.   

    跟NULL 作用差不多。表示无效的GUID
      

  2.   

    可是什么时候才需要用到这个IID_NULL呢?找不到上下文啊
      

  3.   

    网上看到一段操作word接口的程序,还是不明白它为什么要用IID_NULL    //Initialize the COM libraries
        ::CoInitialize(NULL);    // Create an instance of the Word application and obtain the pointer
        // to the application's IDispatch interface.
        CLSID clsid;
        CLSIDFromProgID(L"Word.Application", &clsid);    IUnknown* pUnk;
        HRESULT hr = ::CoCreateInstance( clsid, NULL, CLSCTX_SERVER,
                                         IID_IUnknown, (void**) &pUnk);
        IDispatch* pDispApp;
        hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);    // Get IDispatch* for the Documents collection object
        szFunction = OLESTR("Documents");
        hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
                                      LOCALE_USER_DEFAULT, &dispid_Docs);
        hr = pDispApp->Invoke (dispid_Docs, IID_NULL, LOCALE_USER_DEFAULT,
                               DISPATCH_PROPERTYGET, &dpNoArgs, &vResult,
                               NULL, NULL);
      

  4.   

    HRESULT GetIDsOfNames( 
      REFIID riid, 
      OLECHAR FAR* FAR* rgszNames, 
      unsigned int cNames, 
      LCID lcid, 
      DISPID FAR* rgDispId 
    );
    riid 
    [in] Reserved for future use; set to IID_NULL. 
    rgszNames 
    [in] Passed-in array of names to be mapped. 
    cNames 
    [in] Count of the names to be mapped. 
    lcid 
    [in] Locale context in which to interpret the names. 
    rgDispId 
    [out] Caller-allocated array, each element of which contains an identifier that corresponds to one of the names passed in the rgszNames array. The first element represents the member name. The subsequent elements represent each of the member's parameters.