title: Windows: Overwrite File In Use
body: <p>I am trying to write a utility that will allow moving files in Windows, and when it finds a file in use, will set that file to be moved on reboot.</p>
  
  <p>It seems that MoveFileEx (<a href="http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx</a>) is the right call for this, however I cannot figure out what error code I'm looking for from GetLastError (<a href="http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx</a>) to see that the file was in use.</p>
  
  <p>I want the utility to fail when there is an actual permissions problem.  Is there anyway to differentiate a you-can't-write-there and a in-use overwrite error?</p>
  
  <p>Also, if I have the files I am moving in the user's temporary folder, will they get deleted before the delayed rename?</p>