日期:2014-05-18  浏览次数:20460 次

贴代码 求解..
[DllImportAttribute("F://YHBus.dll", EntryPoint = "GetData", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
  public static extern bool GetData(IntPtr pCommand, DMSTATUS DMStatus, int nSize);
  public struct DMSTATUS//机状态
  {
  public int nYear;
  public int nMonth;
  public int nDay;
  public int nWeek;
  public int nHour;
  public int nMinute;
  public int nSecond;
  public int nRecordCount;
   
  }
  bool tGetData = GetData(m_ActReturn,DMStatus, length);//这里始终返回false DMStatus空值 接受的数据包是正确的.. 求解 

  Console.WriteLine("年:" + DMStatus.nYear.ToString());


------解决方案--------------------
原型是什么,是否该为 ref DMSTATUS DMStatus