Re[3]: Как открыть Корзину
От: Slava Antonov Россия http://deadbeef.narod.ru
Дата: 30.09.04 14:10
Оценка:
Hello SageHermit, you wrote:

> Я так уже пробовал, эта функция не работает с CSIDL_BITBUCKET, в MSDN

> написано:
> If a virtual folder is specified, this function will fail.

Вот решение от Петера Белова:

> Can anyone tell me how to programatically open the folders that display

> the contents of the Network Neighborhood, My Computer and Recycle bin
> folders?
>

Procedure FreePidl( pidl: PItemIDList );
Var
allocator: IMalloc;
Begin
If Succeeded(SHGetMalloc(allocator)) Then Begin
allocator.Free(pidl);
{$IFDEF VER90}
allocator.Release;
{$ENDIF}
End;
End;

procedure TForm1.ButtonClick(Sender: TObject);
var
exInfo: TShellExecuteInfo;
Begin
FillChar( exInfo, Sizeof(exInfo), 0 );
// initialize all fields to 0
With exInfo Do Begin
cbSize:= Sizeof( exInfo ); // required!
fMask := SEE_MASK_FLAG_DDEWAIT or SEE_MASK_IDLIST;
Wnd := Handle;
nShow := SW_SHOWNORMAL;
lpVerb := 'open';
ShGetSpecialFolderLocation( handle, CSIDL_DRIVES ,
PItemIDLIst(lpIDList ));
End;
ShellExecuteEx( @exInfo );
FreePIDL( exinfo.lpIDList );
end;

Needs a bit more error checking but should show the principle. Look at
the entry for ShGetSpecialFolderLocation in win32.hlp to see which
indices to use for other folders.

--
Всего хорошего, Слава
http://slava.users.otts.ru
Posted via RSDN NNTP Server 1.9 gamma
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.