示例#1
0
/**
 * Show file properties.
 * Launches the default File Properties window for the selected item.
 * This method can only handle 1 item and will only show properties
 * for the first item in the passed selection.
 */
HRESULT CNseBaseItem::_DoShowProperties(VFS_MENUCOMMAND& Cmd)
{
   // Get first item or view from selection
   CComPtr<IShellItem> spItem;
   if( Cmd.pShellItems != NULL ) Cmd.pShellItems->GetItemAt(0, &spItem);
   else ::SHCreateItemFromIDList(m_pFolder->m_pidlMonitor, IID_PPV_ARGS(&spItem));
   if( spItem == NULL ) return E_FAIL;
   CPidl pidl;
   HR( pidl.CreateFromObject(spItem) );
   // Show properties for this item
   SHELLEXECUTEINFO sei = { 0 };
   sei.cbSize = sizeof(sei);
   sei.hwnd = Cmd.hWnd;
   sei.fMask = SEE_MASK_INVOKEIDLIST;
   sei.lpVerb = _T("properties");
   sei.lpIDList = pidl;
   sei.nShow = SW_SHOW;
   ::ShellExecuteEx(&sei);
   // We handled this operation successfully for all items in selection
   return NSE_S_ALL_DONE;
}