Delete File Handle Error
-
Hey guys I have soem code that flushes the file buffer if a file was opened using GENERIC_WRITE and then closes the handle. The problem is these functions return an error but when i check them it says error successful any idea whats going wrong heres my code. if(hFileHandle != NULL) { if(dwAccessModeSetting == GENERIC_WRITE) { if(FlushFileBuffers(hFileHandle) == 0) { AfxMessageBox("Flush File Buffer Failed"); //Debug DWORD dwLastError = GetLastError(); ResolveError(dwLastError); } } if(CloseHandle(hFileHandle) == 0) { AfxMessageBox("Close Handle Failed on File Access Destruct"); //Debug DWORD dwLastError = GetLastError(); ResolveError(dwLastError); } }
-
Hey guys I have soem code that flushes the file buffer if a file was opened using GENERIC_WRITE and then closes the handle. The problem is these functions return an error but when i check them it says error successful any idea whats going wrong heres my code. if(hFileHandle != NULL) { if(dwAccessModeSetting == GENERIC_WRITE) { if(FlushFileBuffers(hFileHandle) == 0) { AfxMessageBox("Flush File Buffer Failed"); //Debug DWORD dwLastError = GetLastError(); ResolveError(dwLastError); } } if(CloseHandle(hFileHandle) == 0) { AfxMessageBox("Close Handle Failed on File Access Destruct"); //Debug DWORD dwLastError = GetLastError(); ResolveError(dwLastError); } }
Recover the error before anything else --before the call to
AfxMessageBox
in your case. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo