Click here to Skip to main content
15,906,708 members
Home / Discussions / C#
   

C#

 
GeneralDiagnostics Book Pin
Mark Sanders12-Mar-04 5:11
Mark Sanders12-Mar-04 5:11 
GeneralRe: Diagnostics Book Pin
Heath Stewart12-Mar-04 5:18
protectorHeath Stewart12-Mar-04 5:18 
GeneralStrange Behaviour Pin
Matthew Hazlett12-Mar-04 4:42
Matthew Hazlett12-Mar-04 4:42 
GeneralRe: Strange Behaviour Pin
Heath Stewart12-Mar-04 4:53
protectorHeath Stewart12-Mar-04 4:53 
GeneralMarshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 3:30
Tristan Rhodes12-Mar-04 3:30 
GeneralRe: Marshaling Array of IntPtr Pin
John Fisher12-Mar-04 3:46
John Fisher12-Mar-04 3:46 
General- COM Interface Function Pin
Tristan Rhodes12-Mar-04 3:51
Tristan Rhodes12-Mar-04 3:51 
GeneralRe: Marshaling Array of IntPtr Pin
Heath Stewart12-Mar-04 4:07
protectorHeath Stewart12-Mar-04 4:07 
That's the way it's supposed to work. Read the documentation in the Platform SDK for IEnumXXXX. It's just like an IEnumerator in .NET, only COM's IEnumXXXX implementations can fetch multiple results depending on what you pass into celt (the first param to Next). If you know the size of the object (like an ITEMIDLIST, which you can get with Marshal.SizeOf), you can get the offset the address and get the next object in the array using other methods in the Marshal class, or using an unsafe context.

Another way would be to create an array of ITEMIDLIST (or whatever struct you need, so long as it's defined and attributed properly) and pin the object to gets its address like so:
ITEMIDLIST[] items = new ITEMIDLIST[40];
GCHandle handle = GCHandle.Alloc(items);
int len;
iEnum.Next(items.Length, handle.AddrOfPinnedObject(), out len);
handle.Free();
Then you should be able to access the elements of the array with managed code.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Marshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 4:23
Tristan Rhodes12-Mar-04 4:23 
GeneralRe: Marshaling Array of IntPtr Pin
Heath Stewart12-Mar-04 4:28
protectorHeath Stewart12-Mar-04 4:28 
GeneralRe: Marshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 4:45
Tristan Rhodes12-Mar-04 4:45 
GeneralRe: Marshaling Array of IntPtr Pin
Heath Stewart12-Mar-04 4:50
protectorHeath Stewart12-Mar-04 4:50 
GeneralRe: Marshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 5:24
Tristan Rhodes12-Mar-04 5:24 
GeneralRe: Marshaling Array of IntPtr Pin
Heath Stewart12-Mar-04 5:29
protectorHeath Stewart12-Mar-04 5:29 
GeneralRe: Marshaling Array of IntPtr Pin
Tristan Rhodes12-Mar-04 6:28
Tristan Rhodes12-Mar-04 6:28 
Generalwebservice Pin
cmarmr12-Mar-04 3:26
cmarmr12-Mar-04 3:26 
GeneralRe: webservice Pin
Heath Stewart12-Mar-04 4:09
protectorHeath Stewart12-Mar-04 4:09 
GeneralPrinting With Win32API Pin
Shaun Becker12-Mar-04 3:24
Shaun Becker12-Mar-04 3:24 
GeneralA MDI in a MDI Pin
sixefftee12-Mar-04 3:12
sixefftee12-Mar-04 3:12 
GeneralRe: A MDI in a MDI Pin
ASGill12-Mar-04 4:23
ASGill12-Mar-04 4:23 
GeneralRe: A MDI in a MDI Pin
sixefftee12-Mar-04 6:20
sixefftee12-Mar-04 6:20 
GeneralRe: A MDI in a MDI Pin
John Fisher12-Mar-04 7:53
John Fisher12-Mar-04 7:53 
GeneralRe: A MDI in a MDI Pin
sixefftee12-Mar-04 8:34
sixefftee12-Mar-04 8:34 
GeneralRe: A MDI in a MDI Pin
John Fisher12-Mar-04 11:26
John Fisher12-Mar-04 11:26 
QuestionCan you temporarily lock a directory? Pin
boozebomb112-Mar-04 2:42
boozebomb112-Mar-04 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.