Quantcast
Channel: Visual COBOL
Viewing all articles
Browse latest Browse all 5819

Forum Post: RE: WM_COPYDATA

$
0
0
What you are trying to do will not work as the address you are setting in your .NET application using set pointer to address of...does not generate a usable native pointer. There is no built in support for converting a managed data object to a native pointer so you will have to do this the hard way. The type will need to be changed to a native pointer System.IntPtr and then you need to use Marshal.AllocHGlobal/FreeGlobal Then to get the memory to/from the IntPtr, you need to use Marshall.Copy, I would use a byte[] for the managed memory. As the native memory may move, the code will have to consider the “Pinning” the memory, see/use GCHandleType.Pinned. Lastly, a string is a Unicode and the native code may well be expecting non-unicode. I will put together an example if you still require one but if you have worked around this requirement let me know and I won't bother. Thanks.

Viewing all articles
Browse latest Browse all 5819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>