I use MoveFileEx to move an existing file from one folder to another.
if ( ::MoveFileEx(originalFilepath, renamedFileName,
MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) )
{
LogEvent(“error”);
return “something”;
}
Sometimes when I call this function I get the following error:
GetLastError returns 0x20: The process cannot access the file because it is being used by another process.
What could cause this, and is there anyway I could tell what process has a lock on my file?
More importantly, the file seems to be partially or fully moved to its destination, even though the function returns an error. Could this be possible?
Thanks
Milton
if ( ::MoveFileEx(originalFilepath, renamedFileName,
MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) )
{
LogEvent(“error”);
return “something”;
}
Sometimes when I call this function I get the following error:
GetLastError returns 0x20: The process cannot access the file because it is being used by another process.
What could cause this, and is there anyway I could tell what process has a lock on my file?
More importantly, the file seems to be partially or fully moved to its destination, even though the function returns an error. Could this be possible?
Thanks
Milton