VB里怎样调用VC的COM接口中[out]类的参数,该如何解决
VB里怎样调用VC的COM接口中[out]类的参数
如题
------解决方案--------------------
out的意思是输出参数
有out属性的参数必须是指针
如题
------解决方案--------------------
out的意思是输出参数
有out属性的参数必须是指针
- C/C++ code
[id(1), helpstring("method TestMethod")] HRESULT TestMethod([out] BSTR* outstr, [out] double* outdbl, [out] IDispatch** outobj); STDMETHODIMP CTestClass::TestMethod(BSTR *outstr, double *outdbl, IDispatch **outobj) { *outstr = _bstr_t("你好!").copy(); *outdbl = 3.1415926; _COM_SMARTPTR_TYPEDEF(IDispatch, __uuidof(IDispatch)); IDispatchPtr p; p.CreateInstance("scripting.dictionary"); *outobj = p; p.AddRef(); return S_OK; }