我有现成的代码,但不知参数AHandle如何设定。procedure ToRecycle(AHandle:THandle;AFileName:string);
var
SHFileOpStruct:TShFileOpStruct;
begin
with ShFileOpStruct do
begin
Wnd:=AHandle;
wFunc:=FO_DELETE;
pFrom:=PChar(AFileName);
fFlags:=FOF_ALLOWUNDO;
end;
SHFileOperation(SHFileOpStruct);
end;
var
SHFileOpStruct:TShFileOpStruct;
begin
with ShFileOpStruct do
begin
Wnd:=AHandle;
wFunc:=FO_DELETE;
pFrom:=PChar(AFileName);
fFlags:=FOF_ALLOWUNDO;
end;
SHFileOperation(SHFileOpStruct);
end;
Handle of the dialog box to use to display information about the status of the operation. 但我将AHandle 设为Dialog Box的Handle时,一运行就出错,恳请朋友们指点。
RoRecycle(Form1.handle,'D:\temp.bmp');