>but when I use the marsheling services such as
>Masrhal.PtrToStructure(fileSourceIntPtr,destObj)
>it complains that it cant do this on destObj as it is a value type.
>it wont let me pass it as a ref either.
Use the other PtrToStructure overload
destObj = Marshal.PtrToStructure(fileSourceIntPtr,
typeof(YourStruct));
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
colin - 01 Nov 2007 00:11 GMT
> >but when I use the marsheling services such as
>>Masrhal.PtrToStructure(fileSourceIntPtr,destObj)
[quoted text clipped - 5 lines]
> destObj = Marshal.PtrToStructure(fileSourceIntPtr,
> typeof(YourStruct));
wow cool thanks, i missed that one somehow.
does it make a newly alocated block of memory then copy it to the structure?
or is it cool enough to just use the destination ?
itl prob be probably ok either way.
Colin =^.^=