empty recycle bin/de: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: empty recycle bin/de
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Zurück zur Seite [[code examples/de|Code Beispiele]]. | |
| 2 | + | ||
| 3 | + | Dieser Artikel beschäftigt sich mit der Windowsprogrammierung. | |
| 4 | + | ||
| 5 | + | Die Prozedur leert den Papierkorb ohne Rückfrage. | |
| 6 | + | ||
| 7 | + | Beispiel: | |
| 8 | + | ||
| 9 | + | ``` pascal | |
| 10 | + | uses | |
| 11 | + | Windows, SysUtils, ...; | |
| 12 | + | ||
| 13 | + | ... | |
| 14 | + | ||
| 15 | + | function funPapierkorbLeeren: boolean; | |
| 16 | + | const | |
| 17 | + | SHERB_NOCONFIRMATION = $00000001; | |
| 18 | + | SHERB_NOPROGRESSUI = $00000002; | |
| 19 | + | SHERB_NOSOUND = $00000004; | |
| 20 | + | ||
| 21 | + | type | |
| 22 | + | {Definition der aufzurufenden Funktion wie Sie in der DLL Shell32.dll | |
| 23 | + | definiert ist} | |
| 24 | + | TSHEmptyRecycleBin = function(Wnd: HWND; pszRootPath: PChar; dwrFlag: DWORD): | |
| 25 | + | HRESULT; stdcall; | |
| 26 | + | var | |
| 27 | + | SHEmptyRecycleBin: TSHEmptyRecycleBin; | |
| 28 | + | LibHandle: THandle; | |
| 29 | + | ||
| 30 | + | begin | |
| 31 | + | ||
| 32 | + | Result := False; | |
| 33 | + | ||
| 34 | + | // Ermittelt den Handle der Library | |
| 35 | + | LibHandle := LoadLibrary(PChar('Shell32.dll')); | |
| 36 | + | ||
| 37 | + | try | |
| 38 | + | if LibHandle <> 0 then | |
| 39 | + | begin | |
| 40 | + | {Weisst der Variablen SHEmptyRecycleBin die Adresse des Funktionsaufrufs | |
| 41 | + | der Funktion aus der DLL Shell32.dll zu.} | |
| 42 | + | Pointer(SHEmptyRecycleBin) := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA'); | |
| 43 | + | if @SHEmptyRecycleBin <> nil then | |
| 44 | + | begin | |
| 45 | + | //SHEmptyRecycleBin(Application-Handle ermitteln, ... | |
| 46 | + | SHEmptyRecycleBin(GetParent(Form1.Handle), nil, | |
| 47 | + | SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND); | |
| 48 | + | Result := True; | |
| 49 | + | end; | |
| 50 | + | end; | |
| 51 | + | finally | |
| 52 | + | SHEmptyRecycleBin := nil; | |
| 53 | + | FreeLibrary(LibHandle); | |
| 54 | + | end; | |
| 55 | + | end; | |
| 56 | + | ||
| 57 | + | ... | |
| 58 | + | ``` | |
| 59 | + | ||
| 60 | + | --- | |
| 61 | + | *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](/wiki-contact).* |
