empty recycle bin/de
Zurück zur Seite Code Beispiele.
Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
Die Prozedur leert den Papierkorb ohne Rückfrage.
Beispiel:
uses
Windows, SysUtils, ...;
...
function funPapierkorbLeeren: boolean;
const
SHERB_NOCONFIRMATION = $00000001;
SHERB_NOPROGRESSUI = $00000002;
SHERB_NOSOUND = $00000004;
type
{Definition der aufzurufenden Funktion wie Sie in der DLL Shell32.dll
definiert ist}
TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: PChar; dwrFlag: DWORD):
HRESULT; stdcall;
var
SHEmptyRecycleBin: TSHEmptyRecycleBin;
LibHandle: THandle;
begin
Result := False;
// Ermittelt den Handle der Library
LibHandle := LoadLibrary(PChar('Shell32.dll'));
try
if LibHandle <> 0 then
begin
{Weisst der Variablen SHEmptyRecycleBin die Adresse des Funktionsaufrufs
der Funktion aus der DLL Shell32.dll zu.}
Pointer(SHEmptyRecycleBin) := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA');
if @SHEmptyRecycleBin <> nil then
begin
//SHEmptyRecycleBin(Application-Handle ermitteln, ...
SHEmptyRecycleBin(GetParent(Form1.Handle), nil,
SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND);
Result := True;
end;
end;
finally
SHEmptyRecycleBin := nil;
FreeLibrary(LibHandle);
end;
end;
...From the Free Pascal wiki, page "empty recycle bin/de", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
