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

Вниз

Корзина   Найти похожие ветки 

 
sammy   (2002-02-07 08:42) [0]

Может знает кто как очистить корзину?
подскажите плиз!


 
Ghost. ©   (2002-02-07 08:59) [1]

Есть функция SHEmptyRecycleBin (в shell32.dll), но она не документирована (по крайней мере в win32.hlp ее нет).

или так
program del;

uses

ShellApi;

//function SHFileOperation(const lpFileOp: TSHFileOpStruct): Integer; stdcall;

Var T:TSHFileOpStruct;

P:String;
begin

P:="C:\Windows\System\EL_CONTROL.CPL";
With T do
Begin
Wnd:=0;
wFunc:=FO_DELETE;
pFrom:=Pchar(P);
fFlags:=FOF_ALLOWUNDO
End;
SHFileOperation(T);
End.


 
BlankAlex ©   (2002-02-07 10:32) [2]

посмотри раздел "статьи" за сегодня


 
Севостьянов Игорь ©   (2002-02-07 19:51) [3]

А почему бы не воспользоваться действительно функцией WinAPI

SHEmptyRecycleBin(Hwnd, "", SHERB_NOPROGRESSUI)

Empties the Recycle Bin on the specified drive.

HRESULT SHEmptyRecycleBin(
HWND hwnd,
LPCTSTR pszRootPath,
DWORD dwFlags
);


dwFlag:
SHERB_NOCONFIRMATION = 1
SHERB_NOPROGRESSUI = 2
SHERB_NOSOUND = 4

Parameters
hwnd
Handle to the parent window of any dialog boxes that might be displayed during the operation. This parameter can be NULL.
pszRootPath
Address of a NULL-terminated string that contains the path of the root drive on which the Recycle Bin is located. This parameter can contain the address of a string formatted with the drive, folder, and subfolder names (c:\windows\system . . .). It can also contain an empty string or NULL. If this value is an empty string or NULL, all Recycle Bins on all drives will be emptied.
dwFlags
One or more of the following values: SHERB_NOCONFIRMATION No dialog confirming the deletion of the objects will be displayed.
SHERB_NOPROGRESSUI No dialog indicating the progress will be displayed.
SHERB_NOSOUND No sound will be played when the operation is complete.

Return Values
Returns S_OK if successful, or an OLE-defined error value otherwise.



Ну например так:

unit Unit1;

interface

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

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

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
SHEmptyRecycleBin(0, "", SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
SHEmptyRecycleBin(0, "", 0);
end;

end.



Но для этого тебе понадобиться мой модуль(Unit) написанный специально для этих целей ShellAPIEx, который можно дополнять другими SHELL API функциями (отсутствующих в Borlande)

Вот его код

unit ShellAPIEx;

interface

uses
Windows;

const
shell32 = "shell32.dll";
SHERB_NOCONFIRMATION = 1;
SHERB_NOPROGRESSUI = 2;
SHERB_NOSOUND = 4;


{$EXTERNALSYM SHEmptyRecycleBin}
function SHEmptyRecycleBin(hWnd: HWND; pszRootPath: PChar; dwFlags: DWORD): HRESULT; stdcall;

implementation

function SHEmptyRecycleBin; external shell32 name "SHEmptyRecycleBinA";

end.



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

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

Наверх




Память: 0.48 MB
Время: 0.007 c
1-2620
dfdfd
2002-04-20 18:42
2002.05.02
Спрятать форму при запуске!


14-2674
AFROLOV
2002-03-27 15:30
2002.05.02
А каким архиватором можно открыть файл с расширением HA


1-2616
Gamar
2002-04-20 17:52
2002.05.02
Шрифт в диалогах


1-2622
Ищущий
2002-04-20 19:44
2002.05.02
Case-пакеты


3-2463
Sewix
2002-04-09 14:56
2002.05.02
Sql запрос как выбрать все поля кроме конкретного одного