[StructLayout(LayoutKind.Sequential)] 
private struct COMSTAT  
{  
public int fCtsHold;  
public int fDsrHold;  
public int fRlsdHold;  
public int fXoffHold;  
public int fXoffSent;  
public int fEof;  
public int fTxim;  
public int fReserved;  
public int cbInQue;  
public int cbOutQue;  
}   [StructLayout(LayoutKind.Sequential)] 
private struct DCB 

//taken from c struct in platform sdk  
public int DCBlength;           // sizeof(DCB)  
public int BaudRate;            // current baud rate 
// these are the c struct bit fields, bit twiddle flag to set 
public int fBinary;          // binary mode, no EOF check  
public int fParity;          // enable parity checking  
public int fOutxCtsFlow;      // CTS output flow control  
public int fOutxDsrFlow;      // DSR output flow control  
public int fDtrControl;       // DTR flow control type  
public int fDsrSensitivity;   // DSR sensitivity  
public int fTXContinueOnXoff; // XOFF continues Tx  
public int fOutX;          // XON/XOFF out flow control  
public int fInX;           // XON/XOFF in flow control  
public int fErrorChar;     // enable error replacement  
public int fNull;          // enable null stripping  
public int fRtsControl;     // RTS flow control  
public int fAbortOnError;   // abort on error  
public int fDummy2;        // reserved            
public ushort wReserved;          // not currently used  
public ushort XonLim;             // transmit XON threshold  
public ushort XoffLim;            // transmit XOFF threshold  
public byte ByteSize;           // number of bits/byte, 4-8  
public byte Parity;             // 0-4=no,odd,even,,space  
public byte StopBits;           // 0,1,2 = 1, 1.5, 2  
public char XonChar;            // Tx and Rx XON character  
public char XoffChar;           // Tx and Rx XOFF character  
public char ErrorChar;          // error replacement character  
public char EofChar;            // end of input character  
public char EvtChar;            // received event character  
public ushort wReserved1;         // reserved; do not use  
}以上这两个结构的声明在应用中根本不对,下面的声明才是正确的.但是微软MSDN上的却是和上面的声明一样的,但是微软的Win32API.txt却是按下面的说的,在我应用中下面的也是对的.
现在疑问,这上面的解释,在实际中为什么不能用,这两种解释有什么不同?
什么情况下各自适用?? [StructLayout(LayoutKind.Sequential)]
private struct DCB
{
internal int DCBlength;
internal int BaudRate;
internal int fBitFields ;//See Comments Win32API.Txt fBitFields;
internal Int16 wReserved;
internal Int16 XonLim;
internal Int16 XoffLim;
internal byte ByteSize;
internal byte Parity;
internal byte StopBits;
internal byte XonChar;
internal byte XoffChar;
internal byte ErrorChar;
internal byte EofChar;
internal byte EvtChar;
internal Int16 wReserved1 ;//Reserved - Do Not Use wReserved1;
}
[StructLayout(LayoutKind.Sequential)]
private struct COMSTAT
{
internal int fBitFields;//See Comment Win32API.Txt fBitFields;
internal int cbInQue;
internal int cbOutQue;
}