• <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);
            }


            例子中的代碼是不能按照預想的工作的, 因為回調函數接收的2個參數是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1823) 評論(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
            你看函數用法雖然是這么說明的,
            但是你看例子中的用法是錯了的!  回復  更多評論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來msdn也不是萬能的  回復  更多評論
              
            一本色道久久88—综合亚洲精品 | 狠狠88综合久久久久综合网| 五月丁香综合激情六月久久| 久久久无码一区二区三区| 色综合久久88色综合天天| 一级做a爰片久久毛片免费陪| 久久久久亚洲AV无码麻豆| 91精品国产91久久久久福利| 久久99国产精品久久99小说| 久久综合综合久久狠狠狠97色88| 99久久成人18免费网站| 国产三级久久久精品麻豆三级 | 久久久久国色AV免费观看| 久久久久久国产精品美女| 九九久久精品国产| 亚洲国产精品一区二区久久| 色偷偷88欧美精品久久久| 9999国产精品欧美久久久久久| 97视频久久久| 久久精品国产国产精品四凭| 久久免费的精品国产V∧| 久久中文精品无码中文字幕| 久久综合亚洲色HEZYO国产| 精品人妻久久久久久888| 久久综合亚洲色HEZYO社区| 久久久久久亚洲精品不卡| 狠狠色丁香久久综合婷婷| A狠狠久久蜜臀婷色中文网| 一个色综合久久| 午夜精品久久久久| 久久久久一本毛久久久| 国产精品美女久久久久av爽| 久久国产精品波多野结衣AV| 国内精品久久国产大陆| 国产精品国色综合久久| 无码AV波多野结衣久久| 久久综合噜噜激激的五月天| 日本精品久久久久中文字幕| 狠色狠色狠狠色综合久久| 久久91精品国产91久久麻豆| 91精品国产高清久久久久久国产嫩草 |