当前位置: 首页>>代码示例>>C++>>正文


C++ BookmarkItem::getPidl方法代码示例

本文整理汇总了C++中BookmarkItem::getPidl方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarkItem::getPidl方法的具体用法?C++ BookmarkItem::getPidl怎么用?C++ BookmarkItem::getPidl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BookmarkItem的用法示例。


在下文中一共展示了BookmarkItem::getPidl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnContextMenu

void BookmarkToolBar::OnContextMenu(CWnd* pWnd, CPoint aPoint)
{
    CToolBarCtrl &sToolBarCtrl = GetToolBarCtrl();

    CPoint sClientPoint(aPoint);
    ScreenToClient(&sClientPoint);

    xpr_bool_t sSucceeded = XPR_FALSE;
    xpr_sint_t sIndex = sToolBarCtrl.HitTest(&sClientPoint);
    if (GetKeyState(VK_CONTROL) < 0 && sIndex >= 0)
    {
        BookmarkItem *sBookmarkItem = BookmarkMgr::instance().getBookmark(sIndex);
        if (sBookmarkItem != XPR_NULL)
        {
            LPITEMIDLIST sFullPidl = sBookmarkItem->getPidl();
            if (sFullPidl != XPR_NULL)
            {
                xpr_bool_t    sResult;
                LPSHELLFOLDER sShellFolder = XPR_NULL;
                LPCITEMIDLIST sPidl        = XPR_NULL;

                sResult = fxfile::base::Pidl::getSimplePidl(sFullPidl, sShellFolder, sPidl);
                if (SUCCEEDED(sResult) && sShellFolder != XPR_NULL && sPidl != XPR_NULL)
                {
                    ContextMenu sContextMenu(GetSafeHwnd());
                    if (sContextMenu.init(sShellFolder, &sPidl, 1))
                    {
                        TBBUTTON sTbButton = {0};
                        sToolBarCtrl.GetButton(sIndex, &sTbButton);
                        sToolBarCtrl.SetState(sTbButton.idCommand, TBSTATE_MARKED | TBSTATE_ENABLED);

                        xpr_uint_t sId = sContextMenu.trackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON, &aPoint, CMF_EXPLORE);
                        if (sId != -1)
                        {
                            sId -= sContextMenu.getFirstId();

                            xpr_tchar_t sVerb[0xff] = {0};
                            sContextMenu.getCommandVerb(sId, sVerb, 0xfe);

                            xpr_bool_t sSelfInvoke = XPR_FALSE;

                            if (_tcsicmp(sVerb, CMID_VERB_OPEN) == 0)
                            {
                                gFrame->gotoBookmark(sIndex);
                                sSelfInvoke = XPR_TRUE;
                            }

                            if (sSelfInvoke == XPR_FALSE)
                                sContextMenu.invokeCommand(sId);
                        }

                        sToolBarCtrl.GetButton(sIndex, &sTbButton);
                        sToolBarCtrl.SetState(sTbButton.idCommand, TBSTATE_ENABLED);
                    }

                    sContextMenu.destroy();

                    sSucceeded = XPR_TRUE;
                }

                COM_RELEASE(sShellFolder);
                COM_FREE(sFullPidl);
            }
        }
    }

    if (sSucceeded == XPR_FALSE)
    {
        BCMenu sMenu;
        if (sMenu.LoadMenu(IDR_COOLBAR_BOOKMARKBAR) == XPR_TRUE)
        {
            BCMenu *sPopupMenu = (BCMenu *)sMenu.GetSubMenu(0);
            if (XPR_IS_NOT_NULL(sPopupMenu))
                sPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, aPoint, AfxGetMainWnd());
        }
    }
}
开发者ID:fxfile,项目名称:fxfile,代码行数:77,代码来源:bookmark_toolbar.cpp


注:本文中的BookmarkItem::getPidl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。