'' C++ .h STDMETHODIMP MyATL15(LONG a, LONG b, LONG* c); '' C++ .idl [id(1), helpstring("Method MyATL15")] HRESULT MyATL15([in] LONG a, [in] LONG b, [out,retval] LONG* c); '' C++ .idl [id(2), helpstring("Method MyATL16")] HRESULT MyATL16([in] LONG a, [in] LONG b, [out] LONG* c); Private Sub Command1_Click() Dim a, b, c As Long Dim obj As Object Set obj = CreateObject("ATLSimpleObject15Test") Let a = 22 Let b = 23 c = obj.MyATL15(a, b) '' idl keyword: retval MsgBox (c) Let a = 12 Let b = 19 Call obj.MyATL16(a, b, c) '' equals: obj.MyATL16 a, b, c MsgBox (c) Set obj1 = Nothing End Sub
注意:ATL COM不能被托管代码用invoke方式调用。
反之,.net托管COM代码可以被 C++/VB/C#以invoke方式调用
关于C# Method.Invoke方式调用C++ COM
标签:obj,retval,ATL,C++,idl,LONG,COM,out From: https://www.cnblogs.com/leavind/p/17242364.html