also seehttp://weblogs.asp.net/brada/archive/2004/02/06/69095.aspx
//给你个例子,仅供参考 [StructLayout(LayoutKind.Sequential)] private struct OVERLAPPED { public int Internal; public int InternalHigh; public int Offset; public int OffsetHigh; public int hEvent; } [DllImport("kernel32.dll")] private static extern bool ReadFile( int hFile, // 通信设备句柄 handle to file byte[] lpBuffer, // 数据缓冲区 data buffer int nNumberOfBytesToRead, // 多少字节等待读取 number of bytes to read ref int lpNumberOfBytesRead, // 读取多少字节 number of bytes read ref OVERLAPPED lpOverlapped // 溢出缓冲区 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")]
private static extern bool ReadFile(
int hFile, // 通信设备句柄 handle to file
byte[] lpBuffer, // 数据缓冲区 data buffer
int nNumberOfBytesToRead, // 多少字节等待读取 number of bytes to read
ref int lpNumberOfBytesRead, // 读取多少字节 number of bytes read
ref OVERLAPPED lpOverlapped // 溢出缓冲区 overlapped buffer
);