[id(1), helpstring("method Show1")] HRESULT Show1([out]SAFEARRAY* pSa);
这样为什么不行,应该怎么作呢?

解决方案 »

  1.   

    你最好这样用(这样用,一定行)
     HRESULT Showl([out]VARIANT* pvarArray)
     {
              .....
              pvarArray.vt=VT_ARRAY|VT_BSTR; 
              pvarArray.parray=pSa;       // SAFEARRAY* pSa;
              .....
      }
     或是
     HRESULT Showl([out]SAFEARRAY** ppSa)
     {
              .....
              *ppSa=SafeArrayCreate(.....);             
              ......
      }
      

  2.   

    SAFEARRAY作为out参数应该用两级指针[id(1), helpstring("method Show1")] HRESULT Show1([out]SAFEARRAY** ppSa);