没有合适的资源?快使用搜索试试~ 我知道了~
首页Marshal类的PtrToStructure
PtrToStructure,将数据从非托管内存块封送到新分配的指定类型的托管对象 应用:MFC发送消息到WPF界面上 public IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if ((MsgType)msg == MsgType.WM_TestChip_R) { ChipTest MsgData; MsgData = (ChipT
资源详情
资源评论
资源推荐

Marshal类的类的PtrToStructure
PtrToStructure,将数据从非托管内存块封送到新分配的指定类型的托管对象
应用:MFC发送消息到WPF界面上
public IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if ((MsgType)msg == MsgType.WM_TestChip_R)
{
ChipTest MsgData;
MsgData = (ChipTest)Marshal.PtrToStructure(wParam, typeof(ChipTest)); // 接收封装的消息
currentInfoControlVM.UpdataR(MsgData);
handled = true;
return IntPtr.Zero;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]//设置结构体对齐
public struct tagTestChip
{
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 30, ArraySubType = UnmanagedType.R4)]
public double[] dRst;
}
public struct ChipTest
{
public tagTestChip X_Index;//X索引
public tagTestChip Y_Index;//Y索引
public tagTestChip X_shift;//X偏移
public tagTestChip Y_shift;//Y偏移
public tagTestChip Angle; //旋转角
public tagTestChip Pd; //判定结果
}
底层MFC
参考:



















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0