Click here to Skip to main content
15,902,276 members
Home / Discussions / C#
   

C#

 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
Mazdak12-Mar-04 7:18
Mazdak12-Mar-04 7:18 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
aoyee12-Mar-04 8:40
aoyee12-Mar-04 8:40 
GeneralRe: I want to write a application like Microsoft's PowerPoint User interface... Pin
aoyee13-Mar-04 5:58
aoyee13-Mar-04 5:58 
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 
Hi folks

I've got an array that i am using as a refference to COM that will store the IntPtr's returned from the IEnumID.

<br />
		[PreserveSig]<br />
		int Next(<br />
			/* [In] */int celt,							//Number of items in submitted array<br />
			[MarshalAs(UnmanagedType.LPArray, SizeConst = 100)]<br />
			/* [In, Out] */IntPtr[] rgelt,				//Address of Array<br />
			/* [Out] */out int pceltFetched);			//Address of Item Count<br />


While i have it marshaling as an LPArray, the problem i face is that the pointer points to the first element (as far as I can see), and while, forwarding this array to the Next produces a new result (Assumably the next folder in the enumeration), it is only ever allocated to the first possition. The values for the celt increments properly, but the pCeltFetched is always equal to 1 after the first method call.

Am I marshaling it incorectly? I've tried using SafeArray with an IntPtr type, but the compiler keeps spitting it out.

I know that they are marshaled as in only by default, but is there some special handling procedure for selecting the index that the array should begin at?

I have also tried converting the array to a unmanaged structure, so that i can simply use a pointer to handle it, instead of marshaling to and from managed code with each call. However, i get null pointer exceptions, and it's not liking it. I'm calling like this:

IntPtr[] EnumerationArray = new IntPtr[100];<br />
IntPtr ArrayHandle = IntPtr.Zero;<br />
Marshal.StructureToPtr(EnumerationArray, ArrayHandle,true);


Cheers

Cata
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 
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 

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.