>clickmaker © (30.06.08 13:46)
[1] Ну, одним IContextMenu(2) тут не обойдешься, насколько я понимаю.
Вот кусок кода:
CoInit := CoInitialize(nil);
try
OleCheck(SHGetDesktopFolder(Desktop));
OleCheck(SHGetSpecialFolderLocation(0, CSIDL_DRIVES, PathPIDL));
OleCheck(Desktop.BindToObject(PathPIDL, nil, IID_IShellFolder, Pointer(ShellFolder)));
ShellFolder.ParseDisplayName(WC.Handle, nil, StringToOleStr(Path),
pchEaten, FilePIDL[0], Attr);
OleCheck(CoCreateInstance(StringToGUID(''), nil, CLSCTX_INPROC_SERVER, IUnknown, I));
OleCheck(I.QueryInterface(IID_IShellExtInit, SEI));
OleCheck(SEI.Initialize(FilePIDL[0], nil, 0));
OleCheck(I.QueryInterface(IID_IContextMenu, ICMenu));
ICMenu2 := nil;
ShellContextMenu := CreatePopupMenu;
if Succeeded(ICMenu.QueryContextMenu(ShellContextMenu, 0,
1, $7FFF, CMF_EXPLORE)) and
Succeeded(ICMenu.QueryInterface(IContextMenu2, ICMenu2)) then
CallbackWindow := CreateMenuCallbackWnd(ICMenu2);
try
PopupMenuResult := TrackPopupMenu(ShellContextMenu, TPM_LEFTALIGN or TPM_LEFTBUTTON
or TPM_RIGHTBUTTON or TPM_RETURNCMD,
MousePoint.X, MousePoint.Y, 0, CallbackWindow, nil);
finally
ICMenu2 := nil;
end;
До TrackPopupMenu доходит без ошибок, но меню не выводит.