Click here to Skip to main content
12,946,164 members (54,438 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
This is the first time I am trying to use SAFEARRAYs.
I have the following method declaration in IDL:
//.IMyObj2
[
	object,
	uuid(3454B81A-65A9-4F3E-8678-1D5F82B25837),
	oleautomation,
	nonextensible,
	helpstring("IMyObj2 Interface"),
	pointer_default(unique)
]
interface IMyObj2 : IDispatch{
};
//.IArrayMan3 
[
	object,
	uuid(EF532C8B-12A9-4FEC-B91C-D7502FD68874),
	oleautomation,
	nonextensible,
	helpstring("IArrayMan3 Interface"),
	pointer_default(unique)
]
interface IArrayMan3 : IUnknown{
	[helpstring("method GetArray")] 
	HRESULT _stdcall GetArray2(SAFEARRAY(IMyObj2*)* pArray);
	[helpstring("method PutArray")] 
	HRESULT _stdcall PutArray2(SAFEARRAY(IMyObj2*) pArray);
};

I get the following warning:
warning MIDL2456 : SAFEARRAY(interface pointer) doesn't work using midl generated proxy : [ Parameter 'pArray' of Procedure 'PutArray2' ( Interface 'IArrayMan3' ) ]



Thanks in advance.
Posted 17-Sep-12 16:10pm
Comments
Wes Aday 17-Sep-12 22:38pm
   
http://social.msdn.microsoft.com/Forums/en/vcmfcatl/thread/84a632a9-4e29-4a95-8da7-f7aedb650339
Mem 9021960 18-Sep-12 4:25am
   
I've seen that forum, but I don't resolve the warnings.
Thank you in detail.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Have you declared it as a library? If so, you can use OleView utility to check output in your .tlb file.
I receive this warning only if there is no library incapsulation for this interfaces.

The other way to avoid this warning message might be using the following trick:
    struct SMyObj{
        IMyObj2 * iobject;
    };
 
    interface IArrayMan3 : IUnknown{
	[helpstring("method GetArray")] 
	HRESULT _stdcall GetArray2(SAFEARRAY(struct SMyObj*)* pArray);
	[helpstring("method PutArray")] 
	HRESULT _stdcall PutArray2(SAFEARRAY(struct SMyObj*) pArray);
    };
  Permalink  
v2
Comments
Mem 9021960 18-Sep-12 6:12am
   
Thank you for your detail.
Using the 2nd method, I resolved the warnings.
I declared it at *.idl file using VS2008.
Sorry, Could you help for "I receive this warning only if there is no library incapsulation for this interfaces."?
Thank you again.
skydger 18-Sep-12 6:55am
   
Sure, no problem :)
I use VS2005, so it has no library declaration in .idl file's template. The code is following:

[
uuid(00000001-0001-0001-0001-000000000099),
version(1.0),
helpstring("Library for my interfaces")
]
library MyIfcLibrary{
[
object,
uuid(00000002-0002-0002-0002-000000000002),
oleautomation,
nonextensible,
helpstring("First Interface"),
pointer_default(unique)
]
interface IFirstInterface : IDispatch{
};
...
};
If project set up properly, you'll get .tlb file in output directory after building a project.
Mem 9021960 18-Sep-12 20:58pm
   
Thank you Mr.skydger.
Received a lot of help from you.
skydger 19-Sep-12 4:35am
   
You're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,205
Maciej Los 2,453
Jochen Arndt 1,935
ppolymorphe 1,795


Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100