• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-60  評論-111  文章-0  trackbacks-0
            msdn原文

            CListCtrl::SortItems

            This method sorts list view items using an application-defined comparison function. The index of each item changes to reflect the new sequence.

            BOOL SortItems( PFNLVCOMPARE pfnCompare, DWORD dwData);
            Parameters
            pfnCompare
            Specifies the address of the application-defined comparison function. The comparison function is called during the sort operation each time the relative order of two list items needs to be compared. The comparison function must be either a static member of a class or a standalone function that is not a member of any class.
            dwData
            Specifies the application-defined value that is passed to the comparison function.
            Return Value

            Nonzero if it is successful; otherwise, it is zero. Remarks
            The comparison function has the following form:
            int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, ??LPARAM lParamSort);

            The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent.
            The lParam1 and lParam2 parameters specify the item data for the two items being compared. The lParamSort parameter is the same as the dwData value.

            Example


            //?Sort?the?item?in?reverse?alphabetical?order.
            static?int?CALLBACK?
            MyCompareProc(LPARAM?lParam1,?LPARAM?lParam2,?LPARAM?lParamSort)
            {
            ???
            //?lParamSort?contains?a?pointer?to?the?list?view?control.
            ???CListCtrl*?pListCtrl?=?(CListCtrl*)?lParamSort;
            ???CString????strItem1?
            =?pListCtrl->GetItemText(lParam1,?0);
            ???CString????strItem2?
            =?pListCtrl->GetItemText(lParam2,?0);

            ???
            return?strcmp(strItem2,?strItem1);
            }

            void?snip_CListCtrl_SortItems()
            {
            ???
            //?The?pointer?to?my?list?view?control.
            ???extern?CListCtrl*?pmyListCtrl;

            ???
            //?Sort?the?list?view?items?using?my?callback?procedure.
            ???pmyListCtrl->SortItems(MyCompareProc,?(LPARAM)?pmyListCtrl);
            }


            例子中的代碼是不能按照預想的工作的, 因為回調(diào)函數(shù)接收的2個參數(shù)是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1820) 評論(3)  編輯 收藏 引用 所屬分類: C++

            評論:
            # re: MSDN的Bug! 2007-03-01 09:07 | mzh
            “The lParam1 and lParam2 parameters specify the item data for the two items being compared.”  回復  更多評論
              
            # re: MSDN的Bug! 2007-03-01 22:49 | shaker
            @mzh
            你看函數(shù)用法雖然是這么說明的,
            但是你看例子中的用法是錯了的!  回復  更多評論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來msdn也不是萬能的  回復  更多評論
              
            久久精品无码专区免费青青| 人人狠狠综合久久亚洲高清| 国产精品99久久久精品无码| 囯产极品美女高潮无套久久久| 少妇高潮惨叫久久久久久| 午夜精品久久久久久99热| 久久精品免费观看| 国产精品久久婷婷六月丁香| 丁香五月网久久综合| 97精品国产91久久久久久| 久久狠狠一本精品综合网| 欧美伊人久久大香线蕉综合69| 久久精品亚洲男人的天堂| 国产一区二区三区久久| 亚洲精品乱码久久久久久蜜桃| 久久精品国产亚洲AV无码偷窥| 久久强奷乱码老熟女| 99久久99久久精品免费看蜜桃| 少妇被又大又粗又爽毛片久久黑人| 日韩人妻无码一区二区三区久久 | 看全色黄大色大片免费久久久 | 97精品依人久久久大香线蕉97| 国产成人久久精品区一区二区| 久久强奷乱码老熟女网站 | 国产精品久久久久久一区二区三区 | 91久久九九无码成人网站 | 91精品国产9l久久久久| 久久亚洲国产最新网站| 国产午夜精品久久久久九九电影| 无码人妻久久一区二区三区免费 | 91精品国产91久久久久久青草| 亚洲欧美成人久久综合中文网| 韩国三级大全久久网站| 久久精品夜夜夜夜夜久久| 色婷婷久久综合中文久久蜜桃av| 欧美亚洲国产精品久久高清| 久久精品成人欧美大片| 久久久久国产日韩精品网站| 久久99精品国产麻豆婷婷| 精品久久国产一区二区三区香蕉| 国产精品青草久久久久福利99|