public void get_op_msg()//得到 操作信息的内容 { short ret = Fanuc.cnc_rdopmsg(Fanuc.h, 0, 6 + 256, opmsg); string str2 = "msg"; System.Type type = opmsg.GetType(); if (ret == 0) { for (int i = 1; i < 6; i++) { str2 = "msg" + i; object obj = type.GetField(str2).GetValue(opmsg); System.Type type2 = obj.GetType(); if (Convert.ToInt16(type2.GetField("datano").GetValue(obj)) != -1) { if (Convert.ToInt16(type2.GetField("datano").GetValue(obj)) == 0) { break; } else { listBox3.Items.Add("操作信息: " + type2.GetField("datano").GetValue(obj).ToString() + type2.GetField("data").GetValue(obj).ToString()); } } else { MessageBox.Show("无操作信息"); } } } else { MessageBox.Show(ret + " "); } }