I have to call an API function (unmanaged code in a win32 DLL).
The API function fill a structure like this:
typedef struct _MYSTRUCT
{
UINT Version;
char* Info;
} MYSTRUCT;
The API function takes as argument a pointer to the structure. I can pass it
correctly to the API (I'm sure because the version number is correctly
initialized). But I don't know how to access the Info member to copy his
value to a managed string. It is the API that allocate the memory (actually
just a pointer to a static variable) for the Info member.
Can someone show some actual code ?
--
francois.piette@overbyte.be
http://www.overbyte.be
Francois,
>Can someone show some actual code ?
Make the Info member an IntPtr in managed code, and use
Marshal.PtrToStringAnsi to retrieve the string after the call.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Francois Piette - 03 Oct 2003 09:47 GMT
> Make the Info member an IntPtr in managed code, and use
> Marshal.PtrToStringAnsi to retrieve the string after the call.
Thanks, it works !
--
francois.piette@overbyte.be
http://www.overbyte.be