function ToRecycle(AHandle: THandle; AFileName: string): Boolean;
var
SHFileOpStruct: TSHFileOpStruct;
begin
with SHFileOpStruct do
begin
Wnd := AHandle;
wFunc := FO_DELETE;
pFrom := Pchar(AFileName);
fFlags :=FOF_ALLOWUNDO;
end;
if SHFileOperation(SHFileOpStruct) = 0 then
begin
Result := True;
end
else begin
Result := False;
end;
end;在我的计算机上可以运行,但在其它的计算机上出错:
Access violation at address 77EA8FDA in module 'kernel32.dll'. Read of Address 00070000.如何解决
var
SHFileOpStruct: TSHFileOpStruct;
begin
with SHFileOpStruct do
begin
Wnd := AHandle;
wFunc := FO_DELETE;
pFrom := Pchar(AFileName);
fFlags :=FOF_ALLOWUNDO;
end;
if SHFileOperation(SHFileOpStruct) = 0 then
begin
Result := True;
end
else begin
Result := False;
end;
end;在我的计算机上可以运行,但在其它的计算机上出错:
Access violation at address 77EA8FDA in module 'kernel32.dll'. Read of Address 00070000.如何解决
var
SHFileOpStruct: TSHFileOpStruct;
begin
with SHFileOpStruct do
begin
Wnd := AHandle;
wFunc := FO_DELETE;
pFrom := Pchar(AFileName+#0#0);
pTo := nil;
fFlags :=FOF_ALLOWUNDO;
end;
if SHFileOperation(SHFileOpStruct) = 0 then
begin
Result := True;
end
else begin
Result := False;
end;
end;