To consume a managed type from COM 之三 Calling a .NET Object

Calling a .NET Object
.NET Framework Developer's Guide
Calling a .NET Object

A COM client can create an instance of a public class in an assembly and call the public members of the class. The common language runtime marshals the calls to and from the managed object.

The following code example creates an instance of the Loan class. COM clients cannot access classes directly, but instead call methods, properties, and events exposed by interfaces implemented by the class.(注:COM 客户端不能直接访问类,而是通过接口调用方法、属性、事件等。)

[C++]
ILoanPtr pILoan(__uuidof(Loan));

The ILoan interface exposes several methods and properties, including the GetFirstPmtDistribution method.

[C++]
pILoan->GetFirstPmtDistribution(payment, &Balance, &Principal, &Interest,
       &MorePmts);
原文地址:https://www.cnblogs.com/MayGarden/p/1633954.html