Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
Public Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long最后的参数为0便可以了!

解决方案 »

  1.   

    最后一个参数是指向OVERLAPPED结构的指针。
    一般是设置为NULL的,除非比较特殊的情况。
    BOOL WriteFile(
      HANDLE hFile,                    // handle to file to write to
      LPCVOID lpBuffer,                // pointer to data to write to file
      DWORD nNumberOfBytesToWrite,     // number of bytes to write
      LPDWORD lpNumberOfBytesWritten,  // pointer to number of bytes written
      LPOVERLAPPED lpOverlapped        // pointer to structure for overlapped I/O
    );
     第一参数:句炳;
    第二参数:数据缓冲区;
    第三参数:写入的字节个数
    第四参数:实际写入的字节个数
    第五参数:设置为NULL好了。