Unmanaged code calls my functions. In first function I sould pass back pointer to my managet object. Sometimes later some of my othrer functions got called with that same pointer as one of parameters . I sould dereference it use it to perform some calculations and then if it is not neaded dispose of it.
To cut the story short I need to pin that object so that GC won't move it til I dispose of it. How to do that in C# ?
...
User Profile
Collapse
-
How to pin a pointer to managed object in C#?
-
Maybe you shoud use Marshal.SizeOf( typeof(obj)) -
[ComVisibleAttri bute(true)]
public static void StructureToPtr(
Object structure,
IntPtr ptr,
bool fDeleteOld
)
Parameters
structure
Type: System.Object
A managed object holding the data to be marshaled.
This object must be an instance of a formatted class.
ptr
Type: System.IntPtr
A pointer to an unmanaged block of memory, which
must be allocated before...Leave a comment:
-
Thumbnail shell extension .NET
Does anybody know a working sample how to write thumbnail shell extension that works on XP, or give me a clue how to implement IExtractImage2 interface and requied structs? Thanks in advance.
No activity results to display
Show More
Leave a comment: