null 和 0 好象都不行
但在 vc 里就用 null

解决方案 »

  1.   

    // 溢出缓冲区 overlapped buffer
    [StructLayout(LayoutKind.Sequential)]
    private struct OVERLAPPED { 
        public int  Internal; 
        public int  InternalHigh; 
        public int  Offset; 
        public int  OffsetHigh; 
        public int hEvent; 
    } [DllImport("kernel32.dll", SetLastError=true)]
     static extern int WaitCommEvent (
         int hFile, 
         ref int lpEvtMask, 
         ref OVERLAPPED lpOverlapped) 这样就可以了。
      

  2.   

    // 溢出缓冲区 overlapped buffer
    [StructLayout(LayoutKind.Sequential)]
    private class OVERLAPPED {    //change struct to class
        public int  Internal; 
        public int  InternalHigh; 
        public int  Offset; 
        public int  OffsetHigh; 
        public int hEvent; 
    } [DllImport("kernel32.dll", SetLastError=true)]
     static extern int WaitCommEvent (
         int hFile, 
         ref int lpEvtMask, 
         OVERLAPPED lpOverlapped);    //remove refNow you can use null.