I am trying to write to a file using CreateFile and WriteFile. However, I want to be able to wait until the file is available for access. If another app(some other app I did not write) is accessing it, I want to wait until its access is not restricting CreateFile from successfully opening the file. Is there any way to do this?
(I know it can be accomplished with a sleep-check loop, but I am trying to find a more graceful way of handling it. I am hoping for some windows event notification method).