开发者

COM - return an array of object interfaces

I want to return from IDL an array of interfaces. I try this:

interface ISecurityPolicy : IDispatch{
[id(6)]          HRESULT GetPolicyList([out, ref, retval] SAFEARRAY(IEntityPolicy*)* result);
}

I get this w开发者_如何学运维arning(in VS 2010): Warning 1 warning MIDL2456: SAFEARRAY(interface pointer) doesn't work using midl generated proxy : [ Parameter 'result' of Procedure 'GetPolicyList' ( Interface 'ISecurityPolicy' ) ]

Is this a bogus warning as http://social.msdn.microsoft.com/Forums/en-US/vcmfcatl/thread/84a632a9-4e29-4a95-8da7-f7aedb650339 might suggest ?


Declaring this as:

interface ISecurityPolicy : IDispatch{
[id(6)]          HRESULT GetPolicyList([out, ref, retval] SAFEARRAY(IUnknown*)* result);
}

simplifies things a little for implementation of the interface. It could still be a better idea though instead of returning an array of interfaces to the caller to return it an iterator over the "collection".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜