I have next task. It is necessary to wait of end of editing Microsoft Office files.I use next conventional approach: file is editing While file is busy:
function FileIsBusy(AFileName: string): Boolean;
var
F: Integer;
begin
F := FileOpen(AFileName, fmShareExclusive);
Result := F = -1;
FileClose(F);
end;
function WaitFile(AFileName: string; ASpeepDelay: integer): Boolean;
begin
while FileIsBusy(AFileName) do
Sleep(ASpeepDelay);
Result := True;
end;
This approach good work with editing file by Microsoft Word, not in Open Office. OpenOffice use one process for open multiplicity files just like MS Office. But with OpenOffice Writer have some problems: function FileIsBusy return false just after first saving file by OpenOffice Writer. Have anything suggestions?
============================
I find next solution:
repeat
WaitFile(FFileInfo.lpFile, 333);
Sleep(1000);
until not FileIsBusy(FFileInfo.lpFile);
After preservation, ОО releases a file for some time and again exclusively share