Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.07.28;
Скачать: CL | DM;

Вниз

Как удалять следующие вещи ?   Найти похожие ветки 

 
Dennis S ©   (2003-07-15 12:13) [0]

Народ, помогите, как удалить следующие вещи:
C:\Documents and Settings\"USER-NAME"\Recent\*.*

DeleteFile("C:\Documents and Settings\"USER-NAME"\Recent\*.*");
-не работает...реагирует только на конкретный файл (aleluja.jpg)

Что лутше сделать: через поиск (FindFirst, FindNext) или еще как-нибудь можно?


 
andrey_pst ©   (2003-07-15 12:37) [1]

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure DeleteDirs(Dir : string);
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses FileCtrl;

procedure TForm1.DeleteDirs(Dir : string);
var
sr : TSearchRec;
begin
if FindFirst(Dir + "\*.*", faAnyFile, sr) = 0 then
begin
repeat
if (sr.Attr and faDirectory) <> faDirectory then // это файл
begin
if (sr.Attr and faArchive) = faArchive then // это файл не Archive
FileSetAttr(Dir + "\" + sr.Name, faArchive);
DeleteFile(Dir + "\" + sr.Name);
end
else
if (sr.Name <> "..") and (sr.Name <> ".") then // это директорий
DeleteDirs(Dir + "\" + sr.Name); // Рекурсивный вызов
until FindNext(sr) <> 0;
FindClose(sr);
RemoveDir(ExtractFileDir(Dir + "\"));
end; {if}
end;

procedure TForm1.Button1Click(Sender: TObject);
var
Dir : string;
begin
SelectDirectory("Выбор папки.", "", Dir);
if Dir <> "" then
DeleteDirs(Dir);
ShowMessage("Все.");
end;

end.


 
Babay ©   (2003-07-15 12:46) [2]

Если я правильно понял вопрос то можно так:

uses shlObj;

//очистить меню "Документы"
procedure clearDocuments;
begin
SHAddToRecentDocs(SHARD_PATH,nil);
end;


 
Anatoly Podgoretsky ©   (2003-07-15 12:50) [3]

Dennis S © (15.07.03 12:13)
Лучше ShFileOperation, примеры в Чаво


 
Dennis S ©   (2003-07-15 14:16) [4]

Спасибо всем.
SHAddToRecentDocs(SHARD_PATH,nil) и ShFileOperation
вечером обязательно попробую...



Страницы: 1 вся ветка

Текущий архив: 2003.07.28;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.021 c
14-91887
Dmitriy O.
2003-07-10 07:59
2003.07.28
Хотел бы проконсультироваться


1-91732
RomanP
2003-07-15 12:18
2003.07.28
переопределение функций


14-91873
paxer
2003-07-11 17:09
2003.07.28
Помогите с идиотским вопросом.


1-91756
Kivsiak
2003-07-14 17:03
2003.07.28
Для чего используется qtinf70.dll


6-91786
alt7
2003-05-21 18:06
2003.07.28
TiDAntiFreeze;