question on wrapping IOleContainer

  • Thread starter sheldon woloshyn
  • Start date
S

sheldon woloshyn

I am trying to wrap IOleContainer and having trouble getting the ENumObjects
declaration correct.
This is what I have so far:

[ComImport,
Guid("0000011B-0000-0000-C000-000000000046"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleContainer
{
void ParseDisplayName(
[In, MarshalAs(UnmanagedType.Interface)] object pbc,
[In, MarshalAs(UnmanagedType.BStr)] string pszDisplayName,
[Out, MarshalAs(UnmanagedType.LPArray)] int[] pchEaten,
[Out, MarshalAs(UnmanagedType.LPArray)] object[] ppmkOut);
void EnumObjects([In, MarshalAs(UnmanagedType.U4)] int grfFlags,
[Out, MarshalAs(UnmanagedType.LPArray)] object[] ppenum);
void LockContainer([In, MarshalAs(UnmanagedType.I4)] int fLock);
}

Any suggestions?
 
N

Nicholas Paldino [.NET/C# MVP]

Sheldon,

When you come across IEnumUnknown, that is an interface pointer that is
being returned, so you need to actually declare that interface type, and
then pass it by ref (with the ref keyword), or, you can always pass an
IntPtr by ref (and ignore it).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top