Einzelnen Beitrag anzeigen

Benutzerbild von MuTzE
MuTzE

Registriert seit: 24. Sep 2003
59 Beiträge
 
#6

Re: "SHFileOperation" beschwert sich bei geöffnete

  Alt 5. Okt 2006, 10:11
Probiers mal damit:

Delphi-Quellcode:
function IsFileInUse(Path: string): boolean;
var
  hFile: THandle;
begin
  Result := False;
  if not FileExists(Path) then
   Exit;
  hFile := CreateFile(pchar(Path), GENERIC_READ or GENERIC_WRITE or GENERIC_EXECUTE,
                      0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
  Result := hFile = INVALID_HANDLE_VALUE;
  if not Result then
   CloseHandle(hFile);
end;
  Mit Zitat antworten Zitat