C#-IntPtr转Struct

使用System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr变量, Struct类型),如:

// DATASTRUCT为struct类型名
// lParam为IntPtr类型的变量

DATASTRUCT myStr = (DATASTRUCT)Marshal.PtrToStructure(lParam, typeof(DATASTRUCT));

 

posted @ 2022-12-06 11:41  ꧁执笔小白꧂  阅读(74)  评论(0)    收藏  举报