The C + + notation is:
LRESULT cpicturequerydlg::onquerypicnty (WPARAM WP, LPARAM LP)
{
EnableWindow (TRUE);
BYTE *pbymsg = (byte*) LP;
Get the current page number
M_dwcurcount = *reinterpret_cast<dword*> (pbymsg);
Get the total quantity
M_dwtotalcount = *reinterpret_cast<dword*> (pbymsg + sizeof (DWORD));
Get the query result pointer
tnvr_pic_grabtask* ptresultquery = reinterpret_cast<tnvr_pic_grabtask*> (pbymsg + sizeof (DWORD));
memset (m_atgrtask, 0, sizeof (tnvr_pic_grabtask) * nvr_maxnum_recordquery);
memcpy (M_atgrtask, ptresultquery, M_dwcurcount * sizeof (tnvr_pic_grabtask));
}
You've got IntPtr. You can use type casting to get something in IntPtr:
(the type to get) Marshal.PtrToStructure (ptr,typeof (type to get));//This translates to the type of data you can manipulate in C # and then reads the content,//I don't know if it works for you, Because PtrToStructure does not apply in all cases, if you use this method, you can see the MSDN
The main thing is to get the length of the type, and if the length gets inaccurate, the data read will be problematic.
(Structuretype) Marshal.PtrToStructure ((INTPTR) ((UINT) (pbymsg + sizeof (UINT) * 2 + i * marshal.sizeof (typeof (Structuretype))), typeof ( Structuretype));
Using system;using system.collections.generic;using system.linq;using system.runtime.interopservices;using System.text;namespace opencover.framework.communication{Public interface Imarshalwrapper { T Ptrtostructure<t> (IntPtr pinnedmemory); void structuretoptr<t> (T structure, IntPtr pinnedmemory, bool fdeleteold); } public class Marshalwrapper:imarshalwrapper {public T ptrtostructure<t> (IntPtr pinnedmemory) { return (t) marshal.ptrtostructure (Pinnedmemory, typeof (T)); } public void structuretoptr<t> (T structure, IntPtr pinnedmemory, bool fdeleteold) { MARSHAL.STRUCTURETOPTR (structure, pinnedmemory, fdeleteold);}}
C # reads the data in IntPtr Z