Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2002.05.02;
Скачать: [xml.tar.bz2];

Вниз

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

 
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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.004 c
3-2491
Скалли
2002-04-11 13:53
2002.05.02
Подход к сложной выборке


1-2614
dfdfd
2002-04-20 17:43
2002.05.02
Как перевести String в Pchar?


1-2508
ATLANTIDO
2002-04-19 21:18
2002.05.02
Эмуляция нажатия на клавишу


1-2569
Янушка
2002-04-19 11:47
2002.05.02
Как осуществить загрузку рисунка на форму, не используя TImage?


1-2506
Ilya2000
2002-04-20 20:36
2002.05.02
Основная





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский