I have changed :
CComBSTR bstr2(L"writer8");
pPropVar[1].vt = VT_BSTR;
pPropVar[1].bstrVal = bstr2;

but the problem still exist
----------------------原邮件-------------------
Hi,
maybe these lines could be the cause:

pPropVar[1].vt = VT_BSTR;
pPropVar[1].bstrVal = L"writer8";

You use a wide character string rather then a BSTR. You would have to use
SysAllocString(L"writer8");

or use the CComBSTR class from the ATL.

Regards,
Joachim

Zhan Qiufang. wrote:
> when I call uno function through activex, it throw a exception:
> "InterfaceOleWrapper_Impl::Invoke : 
> [automation bridge]UnoConversionUtilities<T>::variantToAny 
> Cannot convert the value of vartype :"8201"  to the expected UNO type of 
> type class: 12"
> 
> by debug, I found the Invoke function throw this exception,
> who can help me???       
> thanks
> 
> and follow some resource code :
> //////
>       SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( 
> VT_DISPATCH, 0, 1 );
>       long ix = 0;
>       
>       OLECHAR*        sPropMemberNames[2] = { L"Name", 
> L"Value" };
>       CComPtr<IDispatch> pdispPropVal;
>       hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", 
> pdispPropVal );
>       if( !SUCCEEDED( hr ) ) return hr;
>   
>       CComVariant pPropVar[2];
>       pPropVar[0] = CComVariant(L"FilterName" );
>       pPropVar[1] = CComVariant(); pPropVar[1].vt = VT_BSTR; 
> pPropVar[1].bstrVal = L"writer8";
>       
>       hr = PutPropertiesToIDisp( pdispPropVal, sPropMemberNames, 
> pPropVar, 2 );
>       if( !SUCCEEDED( hr ) ) return hr;
>    
>       SafeArrayPutElement( pPropVals, &ix, pdispPropVal );
>       
>       CComVariant aDispArgs[2];
>       
>       aDispArgs[0] = CComVariant(L"d:/ee.odt");
>       aDispArgs[1] = CComVariant(); aDispArgs[1].vt = VT_ARRAY | 
> VT_DISPATCH; aDispArgs[1].parray = pPropVals;
>       CComVariant dummyResult;
>    
>       hr = ExecuteFunc( pModel, L"storeToURL",aDispArgs, 2, 
> &dummyResult );
> //////
> the ExecuteFunc function is:
> HRESULT CDocument::ExecuteFunc( IDispatch* idispUnoObject, 
>                                        OLECHAR* 
> sFuncName, 
>                                        VARIANT* 
> params, 
>                                        unsigned int 
> count, 
>                                        VARIANT* 
> pResult )
> {
>       if( !idispUnoObject )
>               return E_FAIL;
> 
>       DISPID id;
>       HRESULT hr = idispUnoObject->GetIDsOfNames( 
> IID_NULL, &sFuncName, 1, LOCALE_USER_DEFAULT, &id);
>       if( !SUCCEEDED( hr ) ) return hr;
> 
>       DISPPARAMS dispparams= { params, 0, count, 0};
> 
>       // DEBUG
>       EXCEPINFO myInfo;
>       
>       hr = idispUnoObject->Invoke( id, 
> IID_NULL,LOCALE_USER_DEFAULT, DISPATCH_METHOD, 
>                     &dispparams, pResult, &myInfo, 0);
>       return hr;
> } 
> 
> ---------------------------------------------
------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

----------------------------------------------
-----------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to