C
cys805
Unregistered / Unconfirmed
GUEST, unregistred user!
实现清空回收站,代码如下:<br>unit Unit1;<br>interface<br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br>private<br> { Private declarations }<br>public<br> { Public declarations }<br>end;<br>var<br> Form1: TForm1;<br> implementation<br>const<br> SHERB_NOCONFIRMATION = $00000001 ;<br> SHERB_NOPROGRESSUI = $00000002 ;<br> SHERB_NOSOUND = $00000004 ;<br>type<br> TSHEmptyRecycleBin=function(Wnd:HWND;LPCTSTRChar;DWORD:Word):Integer;stdcall;<br> {$R *.dfm}<br> procedure TForm1.Button1Click(Sender: TObject);<br>var<br> SHEmptyRecycleBin:TSHEmptyRecycleBin;<br> LibHandle:THandle;<br>begin<br> LibHandle := LoadLibrary(PChar('Shell32.dll')) ;<br> if LibHandle <> 0 then<br> begin<br> @SHEmptyRecycleBin := GetProcAddress(LibHandle, 'SHEmptyRecycleBinA');<br> end<br> else<br> begin<br> MessageDlg('Failed to load Shell32.dll.', mtError, [mbOK], 0);<br> Exit ;<br> end ;<br> if @SHEmptyRecycleBin <> nil then<br> begin<br> SHEmptyRecycleBin(Application.Handle,'',SHERB_NOCONFIRMATION or SHERB_NOPROGRESSUI or SHERB_NOSOUND) ;<br> end;<br> FreeLibrary(LibHandle);<br> @SHEmptyRecycleBin := nil ;<br>end;<br>end. <br>报错:Illegal character in input file: ' ' ($A1A1)常量定义错误。怎么改?为什么会有错误?