Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
X

Xequen

@Xequen
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WriteFile returning zero and GetLastError returning 997(ERROR_IO_PENDING)
    X Xequen

    If serial_handle was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the write operation starts at the offset specified in the OVERLAPPED structure and WriteFile may return before the write operation has been completed. In this case, WriteFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue processing while the write operation is being completed. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the write operation. If serial_handle was not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the write operation starts at the current file position and WriteFile does not return until the operation has been completed. The former is asynchoronous and the latter is synchoronous. about your question,you can invoke "GetOverlappedResult( HANDLE hFile, // handle to file, pipe, or device LPOVERLAPPED lpOverlapped, // overlapped structure LPDWORD lpNumberOfBytesTransferred, // bytes transferred BOOL bWait // wait option );" this function to get result of WriteFile(); eg: success = WriteFil(serial_handle ,&temp,5,&temp1,&overlappRead); if(!success) { DWORD dwErrorCode = GetLastError(); switch(dwErrorCode) { case ERROR_IO_PENDING://IO is operating { GetOverlappedResult(serial_handle,&overlapped,&temp1,TRUE); //infinitely wait for WriteFile() operation compelete break; } //others error code default: { break } } }

    C / C++ / MFC help json tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups