variable dir passed : C:\Documents and Settings\Sylvain Ard\Mes documents\Mes images\IcĂ´nes extraits\ procedure DeleteDir (dir :string);// efface un dossier mm plein var lpFileOp:TSHFILEOPSTRUCTA; TabFrom:array[0..255] of char; i:integer; begin //remove dir setlasterror(0); if directoryexists(dir) then begin For i:=0 to length(dir)-1 do TabFrom[i]:=dir[i+1]; TabFrom[length(dir)]:=#0; TabFrom[length(dir)+1]:=#0; lpFileOp.Wnd:=hwnd(0); lpFileOp.wFunc:=FO_DELETE; lpFileOp.pFrom:=TabFrom; lpFileOp.pTo:=''; lpFileOp.fFlags:=FOF_NOCONFIRMATION+FOF_SILENT; SHFileOperation(lpFileOp); end; display_win32_error; // my home function to display the last Win32 error // its details are not interesting for fixing this bug... end;