核心提示:usesShlObj, ShellAPI, ... ; Place a TButton named 'OpenBinButton' on a form, handle its OnClick even...
usesShlObj, ShellAPI, ... ;
Place a TButton named "OpenBinButton" on a form, handle its OnClick event as:
procedure TRecycleBinForm.OpenBinButtonClick(Sender: TObject) ;
var
recycleBinPIDL: PItemIDList;
execInfo: TShellExecuteInfo;
begin
SHGetSpecialFolderLocation(Handle, CSIDL_BITBUCKET, recycleBinPIDL) ;
with execInfo do
begin
cbSize := Sizeof(execInfo) ;
fMask := SEE_MASK_IDLIST;
Wnd := Handle;
lpVerb := nil;
lpFile := nil;
lpParameters := nil;
lpDirectory := nil;
nShow := SW_SHOWNORMAL;
hInstApp:=0;
lpIDList := recycleBinPIDL;
end;
ShellExecuteEx(@execInfo) ;
end;